home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / lisp / wcl-21.lha / wcl-2.1 / doc / clx-doc.lisp < prev    next >
Lisp/Scheme  |  1992-09-10  |  140KB  |  3,805 lines

  1. ;;; -*- Mode: LISP; Syntax: Common-lisp; Package: XLIB; Base: 10; Lowercase: Yes -*-
  2.  
  3. ;;; Copyright 1987, 1988 Massachusetts Institute of Technology, and
  4. ;;;             Texas Instruments Incorporated
  5.  
  6. ;;; Permission to use, copy, modify, and distribute this document for any purpose
  7. ;;; and without fee is hereby granted, provided that the above copyright notice
  8. ;;; appear in all copies and that both that copyright notice and this permission
  9. ;;; notice are retained, and that the name of M.I.T. not be used in advertising or
  10. ;;; publicity pertaining to this document without specific, written prior
  11. ;;; permission.  M.I.T. makes no representations about the suitability of this
  12. ;;; document or the protocol defined in this document for any purpose.  It is
  13. ;;; provided "as is" without express or implied warranty.
  14.  
  15. ;;; Texas Instruments Incorporated provides this document "as is" without
  16. ;;; express or implied warranty.
  17.  
  18. ;; Version 4
  19.  
  20. ;; This is considered a somewhat changeable interface.  Discussion of better
  21. ;; integration with CLOS, support for user-specified subclassess of basic
  22. ;; objects, and the additional functionality to match the C Xlib is still in
  23. ;; progress.
  24.  
  25. ;; Primary Interface Author:
  26. ;;    Robert W. Scheifler
  27. ;;    MIT Laboratory for Computer Science
  28. ;;    545 Technology Square, Room 418
  29. ;;    Cambridge, MA 02139
  30. ;;    rws@zermatt.lcs.mit.edu
  31.  
  32. ;; Design Contributors:
  33. ;;    Dan Cerys, Texas Instruments
  34. ;;    Scott Fahlman, CMU
  35. ;;      Charles Hornig, Symbolics
  36. ;;      John Irwin, Franz
  37. ;;    Kerry Kimbrough, Texas Instruments
  38. ;;    Chris Lindblad, MIT
  39. ;;    Rob MacLachlan, CMU
  40. ;;    Mike McMahon, Symbolics
  41. ;;    David Moon, Symbolics
  42. ;;    LaMott Oren, Texas Instruments
  43. ;;    Daniel Weinreb, Symbolics
  44. ;;    John Wroclawski, MIT
  45. ;;    Richard Zippel, Symbolics
  46.  
  47. ;; CLX Extensions
  48. ;; Adds some of the functionality provided by the C XLIB library.
  49. ;;
  50. ;; Primary Author
  51. ;;    LaMott G. Oren
  52. ;;    Texas Instruments
  53. ;; 
  54. ;; Design Contributors:
  55. ;;    Robert W. Scheifler, MIT
  56.  
  57.  
  58. ;; Note: all of the following is in the package XLIB.
  59.  
  60. ;; Note: various perversions of the CL type system are used below.
  61. ;; Examples: (list elt-type) (sequence elt-type)
  62.  
  63. (proclaim '(declaration arglist values))
  64.  
  65. ;; Note: if you have read the Version 11 protocol document or C Xlib manual, most of
  66. ;; the relationships should be fairly obvious.  We have no intention of writing yet
  67. ;; another moby document for this interface.
  68.  
  69. (deftype card32 () '(unsigned-byte 32))
  70.  
  71. (deftype card29 () '(unsigned-byte 29))
  72.  
  73. (deftype int32 () '(signed-byte 32))
  74.  
  75. (deftype card16 () '(unsigned-byte 16))
  76.  
  77. (deftype int16 () '(signed-byte 16))
  78.  
  79. (deftype card8 () '(unsigned-byte 8))
  80.  
  81. (deftype int8 () '(signed-byte 8))
  82.  
  83. (deftype mask32 () 'card32)
  84.  
  85. (deftype mask16 () 'card16)
  86.  
  87. (deftype resource-id () 'card29)
  88.  
  89. ;; Types employed: display, window, pixmap, cursor, font, gcontext, colormap, color.
  90. ;; These types are defined solely by a functional interface; we do not specify
  91. ;; whether they are implemented as structures or flavors or ...  Although functions
  92. ;; below are written using DEFUN, this is not an implementation requirement (although
  93. ;; it is a requirement that they be functions as opposed to macros or special forms).
  94. ;; It is unclear whether with-slots in the Common Lisp Object System must work on
  95. ;; them.
  96.  
  97. ;; Windows, pixmaps, cursors, fonts, gcontexts, and colormaps are all represented as
  98. ;; compound objects, rather than as integer resource-ids.  This allows applications
  99. ;; to deal with multiple displays without having an explicit display argument in the
  100. ;; most common functions.  Every function uses the display object indicated by the
  101. ;; first argument that is or contains a display; it is an error if arguments contain
  102. ;; different displays, and predictable results are not guaranteed.
  103.  
  104. ;; Each of window, pixmap, drawable, cursor, font, gcontext, and colormap have the
  105. ;; following five functions:
  106.  
  107. (defun <mumble>-display (<mumble>)
  108.   (declare (type <mumble> <mumble>)
  109.        (values display)))
  110.  
  111. (defun <mumble>-id (<mumble>)
  112.   (declare (type <mumble> <mumble>)
  113.        (values resource-id)))
  114.  
  115. (defun <mumble>-equal (<mumble>-1 <mumble>-2)
  116.   (declare (type <mumble> <mumble>-1 <mumble>-2)))
  117.  
  118. (defun <mumble>-p (<mumble>)
  119.   (declare (type <mumble> <mumble>)
  120.        (values boolean)))
  121.  
  122. ;; The following functions are provided by color objects:
  123.  
  124. ;; The intention is that IHS and YIQ and CYM interfaces will also exist.  Note that
  125. ;; we are explicitly using a different spectrum representation than what is actually
  126. ;; transmitted in the protocol.
  127.  
  128. (deftype rgb-val () '(real 0 1))
  129.  
  130. (defun make-color (&key red green blue &allow-other-keys)    ; for expansion
  131.   (declare (type rgb-val red green blue)
  132.        (values color)))
  133.  
  134. (defun color-rgb (color)
  135.   (declare (type color color)
  136.        (values red green blue)))
  137.  
  138. (defun color-red (color)
  139.   ;; setf'able
  140.   (declare (type color color)
  141.        (values rgb-val)))
  142.  
  143. (defun color-green (color)
  144.   ;; setf'able
  145.   (declare (type color color)
  146.        (values rgb-val)))
  147.  
  148. (defun color-blue (color)
  149.   ;; setf'able
  150.   (declare (type color color)
  151.        (values rgb-val)))
  152.  
  153. (deftype drawable () '(or window pixmap))
  154.  
  155. ;; Atoms are accepted as strings or symbols, and are always returned as keywords.
  156. ;; Protocol-level integer atom ids are hidden, using a cache in the display object.
  157.  
  158. (deftype xatom () '(or string symbol))
  159.  
  160. (deftype stringable () '(or string symbol))
  161.  
  162. (deftype fontable () '(or stringable font))
  163.  
  164. ;; Nil stands for CurrentTime.
  165.  
  166. (deftype timestamp () '(or null card32))
  167.  
  168. (deftype bit-gravity () '(member :forget :static :north-west :north :north-east
  169.                  :west :center :east :south-west :south :south-east))
  170.  
  171. (deftype win-gravity () '(member :unmap :static :north-west :north :north-east
  172.                  :west :center :east :south-west :south :south-east))
  173.  
  174. (deftype grab-status ()
  175.   '(member :success :already-grabbed :frozen :invalid-time :not-viewable))
  176.  
  177. (deftype boolean () '(or null (not null)))
  178.  
  179. (deftype pixel () '(unsigned-byte 32))
  180. (deftype image-depth () '(integer 0 32))
  181.  
  182. (deftype keysym () 'card32)
  183.  
  184. (deftype array-index () `(integer 0 ,array-dimension-limit))
  185.  
  186. ;; An association list.
  187.  
  188. (deftype alist (key-type-and-name datum-type-and-name) 'list)
  189.  
  190. ;; A sequence, containing zero or more repetitions of the given elements,
  191. ;; with the elements expressed as (type name).
  192.  
  193. (deftype repeat-seq (&rest elts) 'sequence)
  194.  
  195. (deftype point-seq () '(repeat-seq (int16 x) (int16 y)))
  196.  
  197. (deftype seg-seq () '(repeat-seq (int16 x1) (int16 y1) (int16 x2) (int16 y2)))
  198.  
  199. (deftype rect-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)))
  200.  
  201. ;; Note that we are explicitly using a different angle representation than what
  202. ;; is actually transmitted in the protocol.
  203.  
  204. (deftype angle () '(real #.(* -2 pi) #.(* 2 pi)))
  205.  
  206. (deftype arc-seq () '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height)
  207.                  (angle angle1) (angle angle2)))
  208.  
  209. (deftype event-mask-class ()
  210.   '(member :key-press :key-release :owner-grab-button :button-press :button-release
  211.        :enter-window :leave-window :pointer-motion :pointer-motion-hint
  212.        :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  213.        :button-5-motion :button-motion :exposure :visibility-change
  214.        :structure-notify :resize-redirect :substructure-notify :substructure-redirect
  215.        :focus-change :property-change :colormap-change :keymap-state))
  216.  
  217. (deftype event-mask ()
  218.   '(or mask32 (list event-mask-class)))
  219.  
  220. (deftype pointer-event-mask-class ()
  221.   '(member :button-press :button-release
  222.        :enter-window :leave-window :pointer-motion :pointer-motion-hint
  223.        :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  224.        :button-5-motion :button-motion :keymap-state))
  225.  
  226. (deftype pointer-event-mask ()
  227.   '(or mask32 (list pointer-event-mask-class)))
  228.  
  229. (deftype device-event-mask-class ()
  230.   '(member :key-press :key-release :button-press :button-release :pointer-motion
  231.        :button-1-motion :button-2-motion :button-3-motion :button-4-motion
  232.        :button-5-motion :button-motion))
  233.  
  234. (deftype device-event-mask ()
  235.   '(or mask32 (list device-event-mask-class)))
  236.  
  237. (deftype modifier-key ()
  238.   '(member :shift :lock :control :mod-1 :mod-2 :mod-3 :mod-4 :mod-5))
  239.  
  240. (deftype modifier-mask ()
  241.   '(or (member :any) mask16 (list modifier-key)))
  242.  
  243. (deftype state-mask-key ()
  244.   '(or modifier-key (member :button-1 :button-2 :button-3 :button-4 :button-5)))
  245.  
  246. (deftype gcontext-key ()
  247.   '(member :function :plane-mask :foreground :background
  248.        :line-width :line-style :cap-style :join-style :fill-style :fill-rule
  249.        :arc-mode :tile :stipple :ts-x :ts-y :font :subwindow-mode
  250.        :exposures :clip-x :clip-y :clip-mask :dash-offset :dashes))
  251.  
  252. (deftype event-key ()
  253.   '(member :key-press :key-release :button-press :button-release :motion-notify
  254.        :enter-notify :leave-notify :focus-in :focus-out :keymap-notify
  255.        :exposure :graphics-exposure :no-exposure :visibility-notify
  256.        :create-notify :destroy-notify :unmap-notify :map-notify :map-request
  257.        :reparent-notify :configure-notify :gravity-notify :resize-request
  258.        :configure-request :circulate-notify :circulate-request :property-notify
  259.        :selection-clear :selection-request :selection-notify
  260.        :colormap-notify :client-message))
  261.  
  262. (deftype error-key ()
  263.   '(member :access :alloc :atom :colormap :cursor :drawable :font :gcontext :id-choice
  264.        :illegal-request :implementation :length :match :name :pixmap :value :window))
  265.  
  266. (deftype draw-direction ()
  267.   '(member :left-to-right :right-to-left))
  268.  
  269. (defstruct bitmap-format
  270.   (unit <unspec> :type (member 8 16 32))
  271.   (pad <unspec> :type (member 8 16 32))
  272.   (lsb-first-p <unspec> :type boolean))
  273.  
  274. (defstruct pixmap-format
  275.   (depth <unspec> :type image-depth)
  276.   (bits-per-pixel <unspec> :type (member 1 4 8 16 24 32))
  277.   (pad <unspec> :type (member 8 16 32)))
  278.  
  279. (defstruct visual-info
  280.   (id <unspec> :type resource-id)
  281.   (display <unspec> :type display)
  282.   (class <unspec> :type (member :static-gray :static-color :true-color
  283.                 :gray-scale :pseudo-color :direct-color))
  284.   (red-mask <unspec> :type pixel)
  285.   (green-mask <unspec> :type pixel)
  286.   (blue-mask <unspec> :type pixel)
  287.   (bits-per-rgb <unspec> :type card8)
  288.   (colormap-entries <unspec> :type card16))
  289.  
  290. (defstruct screen
  291.   (root <unspec> :type window)
  292.   (width <unspec> :type card16)
  293.   (height <unspec> :type card16)
  294.   (width-in-millimeters <unspec> :type card16)
  295.   (height-in-millimeters <unspec> :type card16)
  296.   (depths <unspec> :type (alist (image-depth depth) ((list visual-info) visuals)))
  297.   (root-depth <unspec> :type image-depth)
  298.   (root-visual-info <unspec> :type visual-info)
  299.   (default-colormap <unspec> :type colormap)
  300.   (white-pixel <unspec> :type pixel)
  301.   (black-pixel <unspec> :type pixel)
  302.   (min-installed-maps <unspec> :type card16)
  303.   (max-installed-maps <unspec> :type card16)
  304.   (backing-stores <unspec> :type (member :never :when-mapped :always))
  305.   (save-unders-p <unspec> :type boolean)
  306.   (event-mask-at-open <unspec> :type mask32))
  307.  
  308. (defun screen-root-visual (screen)
  309.   (declare (type screen screen)
  310.        (values resource-id)))
  311.  
  312. ;; The list contains alternating keywords and integers.
  313.  
  314. (deftype font-props () 'list)
  315.  
  316. (defun open-display (host &key (display 0) protocol)
  317.   ;; A string must be acceptable as a host, but otherwise the possible types for host
  318.   ;; and protocol are not constrained, and will likely be very system dependent.  The
  319.   ;; default protocol is system specific.  Authorization, if any, is assumed to come
  320.   ;; from the environment somehow.
  321.   (declare (type integer display)
  322.        (values display)))
  323.  
  324. (defun display-protocol-major-version (display)
  325.   (declare (type display display)
  326.        (values card16)))
  327.  
  328. (defun display-protocol-minor-version (display)
  329.   (declare (type display display)
  330.        (values card16)))
  331.  
  332. (defun display-vendor-name (display)
  333.   (declare (type display display)
  334.        (values string)))
  335.  
  336. (defun display-release-number (display)
  337.   (declare (type display display)
  338.        (values card32)))
  339.  
  340. (defun display-image-lsb-first-p (display)
  341.   (declare (type display display)
  342.        (values boolean)))
  343.  
  344. (defun display-bitmap-formap (display)
  345.   (declare (type display display)
  346.        (values bitmap-format)))
  347.  
  348. (defun display-pixmap-formats (display)
  349.   (declare (type display display)
  350.        (values (list pixmap-formats))))
  351.  
  352. (defun display-roots (display)
  353.   (declare (type display display)
  354.        (values (list screen))))
  355.  
  356. (defun display-motion-buffer-size (display)
  357.   (declare (type display display)
  358.        (values card32)))
  359.  
  360. (defun display-max-request-length (display)
  361.   (declare (type display display)
  362.        (values card16)))
  363.  
  364. (defun display-min-keycode (display)
  365.   (declare (type display display)
  366.        (values card8)))
  367.  
  368. (defun display-max-keycode (display)
  369.   (declare (type display display)
  370.        (values card8)))
  371.  
  372. (defun close-display (display)
  373.   (declare (type display display)))
  374.  
  375. (defun display-error-handler (display)
  376.   (declare (type display display)
  377.        (values handler)))
  378.  
  379. (defsetf display-error-handler (display) (handler)
  380.   ;; All errors (synchronous and asynchronous) are processed by calling an error
  381.   ;; handler in the display.  If handler is a sequence it is expected to contain
  382.   ;; handler functions specific to each error; the error code is used to index the
  383.   ;; sequence, fetching the appropriate handler.  Any results returned by the handler
  384.   ;; are ignored; it is assumed the handler either takes care of the error
  385.   ;; completely, or else signals. For all core errors, the keyword/value argument
  386.   ;; pairs are:
  387.   ;;    :major card8
  388.   ;;    :minor card16
  389.   ;;    :sequence card16
  390.   ;;    :current-sequence card16
  391.   ;;    :asynchronous (member t nil)
  392.   ;; For :colormap, :cursor, :drawable, :font, :gcontext, :id-choice, :pixmap, and
  393.   ;; :window errors another pair is:
  394.   ;;    :resource-id card32
  395.   ;; For :atom errors, another pair is:
  396.   ;;    :atom-id card32
  397.   ;; For :value errors, another pair is:
  398.   ;;    :value card32
  399.   (declare (type display display)
  400.        (type (or (sequence (function (display symbol &rest key-vals)))
  401.              (function (display symbol &rest key-vals)))
  402.          handler)))
  403.  
  404. (defsetf display-report-asynchronous-errors (display) (when)
  405.   ;; Most useful in multi-process lisps.
  406.   ;;
  407.   ;; Synchronous errors are always signalled in the process that made the
  408.   ;; synchronous request.  An error is considered synchronous if a process is
  409.   ;; waiting for a reply with the same request-id as the error.
  410.   ;; 
  411.   ;; Asynchronous errors can be signalled at any one of these three times:
  412.   ;; 
  413.   ;; 1.  As soon as they are read.  They get signalled in whichever process 
  414.   ;; was doing the reading.  This is enabled by
  415.   ;;       (setf (xlib:display-report-asynchronous-errors display)
  416.   ;;             '(:immediately))
  417.   ;; This is the default.
  418.   ;; 
  419.   ;; 2.  Before any events are to be handled.  You get these by doing an
  420.   ;; event-listen with any timeout value other than 0, or in of the event
  421.   ;; processing forms.  This is useful if you using a background process to
  422.   ;; handle input.  This is enabled by
  423.   ;;       (setf (xlib:display-report-asynchronous-errors display)
  424.   ;;             '(:before-event-handling)) 
  425.   ;; 
  426.   ;; 3.  After a display-finish-output.  You get these by doing a
  427.   ;; display-finish-output.  A cliche using this might have a with-display
  428.   ;; wrapped around the display operations that possibly cause an asynchronous
  429.   ;; error, with a display-finish-output right the end of the with-display to
  430.   ;; catch any asynchronous errors.  This is enabled by
  431.   ;;       (setf (xlib:display-report-asynchronous-errors display)
  432.   ;;             '(:after-finish-output))
  433.   ;; 
  434.   ;; You can select any combination of the three keywords.  For example, to
  435.   ;; get errors reported before event handling and after finish-output,
  436.   ;;       (setf (xlib:display-report-asynchronous-errors display)
  437.   ;;             '(:before-event-handling :after-finish-output))
  438.   (declare (type list when))
  439.   )
  440.  
  441. (defmacro define-condition (name base &body items)
  442.   ;; just a place-holder here for the real thing
  443.   )
  444.  
  445. (define-condition request-error error
  446.   display
  447.   major
  448.   minor
  449.   sequence
  450.   current-sequence
  451.   asynchronous)
  452.  
  453. (defun default-error-handler (display error-key &rest key-vals)
  454.   ;; The default display-error-handler.
  455.   ;; It signals the conditions listed below.
  456.   (declare (type display display)
  457.        (type symbol error-key))
  458.   )
  459.  
  460. (define-condition resource-error request-error
  461.   resource-id)
  462.  
  463. (define-condition access-error request-error)
  464.  
  465. (define-condition alloc-error request-error)
  466.  
  467. (define-condition atom-error request-error
  468.   atom-id)
  469.  
  470. (define-condition colormap-error resource-error)
  471.  
  472. (define-condition cursor-error resource-error)
  473.  
  474. (define-condition drawable-error resource-error)
  475.  
  476. (define-condition font-error resource-error)
  477.  
  478. (define-condition gcontext-error resource-error)
  479.  
  480. (define-condition id-choice-error resource-error)
  481.  
  482. (define-condition illegal-request-error request-error)
  483.  
  484. (define-condition implementation-error request-error)
  485.  
  486. (define-condition length-error request-error)
  487.  
  488. (define-condition match-error request-error)
  489.  
  490. (define-condition name-error request-error)
  491.  
  492. (define-condition pixmap-error resource-error)
  493.  
  494. (define-condition value-error request-error
  495.   value)
  496.  
  497. (define-condition window-error resource-error)
  498.  
  499. (defmacro with-display ((display) &body body)
  500.   ;; This macro is for use in a multi-process environment.  It provides exclusive
  501.   ;; access to the local display object for multiple request generation.  It need not
  502.   ;; provide immediate exclusive access for replies; that is, if another process is
  503.   ;; waiting for a reply (while not in a with-display), then synchronization need not
  504.   ;; (but can) occur immediately.  Except where noted, all routines effectively
  505.   ;; contain an implicit with-display where needed, so that correct synchronization
  506.   ;; is always provided at the interface level on a per-call basis.  Nested uses of
  507.   ;; this macro will work correctly.  This macro does not prevent concurrent event
  508.   ;; processing; see with-event-queue.
  509.   )
  510.  
  511. (defun display-force-output (display)
  512.   ;; Output is normally buffered; this forces any buffered output.
  513.   (declare (type display display)))
  514.  
  515. (defun display-finish-output (display)
  516.   ;; Forces output, then causes a round-trip to ensure that all possible errors and
  517.   ;; events have been received.
  518.   (declare (type display display)))
  519.  
  520. (defun display-after-function (display)
  521.   ;; setf'able
  522.   ;; If defined, called after every protocol request is generated, even those inside
  523.   ;; explicit with-display's, but never called from inside the after-function itself.
  524.   ;; The function is called inside the effective with-display for the associated
  525.   ;; request.  Default value is nil.  Can be set, for example, to
  526.   ;; #'display-force-output or #'display-finish-output.
  527.   (declare (type display display)
  528.        (values (or null (function (display))))))
  529.  
  530. (defun create-window (&key parent x y width height (depth 0) (border-width 0)
  531.               (class :copy) (visual :copy)
  532.               background border gravity bit-gravity
  533.               backing-store backing-planes backing-pixel save-under
  534.               event-mask do-not-propagate-mask override-redirect
  535.               colormap cursor)
  536.   ;; Display is obtained from parent.  Only non-nil attributes are passed on in the
  537.   ;; request: the function makes no assumptions about what the actual protocol
  538.   ;; defaults are.  Width and height are the inside size, excluding border.
  539.   (declare (type window parent)
  540.        (type int16 x y)
  541.        (type card16 width height depth border-width)
  542.        (type (member :copy :input-output :input-only) class)
  543.        (type (or (member :copy) visual-info) visual)
  544.        (type (or null (member :none :parent-relative) pixel pixmap) background)
  545.        (type (or null (member :copy) pixel pixmap) border)
  546.        (type (or null win-gravity) gravity)
  547.        (type (or null bit-gravity) bit-gravity)
  548.        (type (or null (member :not-useful :when-mapped :always) backing-store))
  549.        (type (or null pixel) backing-planes backing-pixel)
  550.        (type (or null event-mask) event-mask)
  551.        (type (or null device-event-mask) do-not-propagate-mask)
  552.        (type (or null (member :on :off)) save-under override-redirect)
  553.        (type (or null (member :copy) colormap) colormap)
  554.        (type (or null (member :none) cursor) cursor)
  555.        (values window)))
  556.  
  557. (defun window-class (window)
  558.   (declare (type window window)
  559.        (values (member :input-output :input-only))))
  560.  
  561. (defun window-visual-info (window)
  562.   (declare (type window window)
  563.        (values visual-info)))
  564.  
  565. (defun window-visual (window)
  566.   (declare (type window window)
  567.        (values resource-id)))
  568.  
  569. (defsetf window-background (window) (background)
  570.   (declare (type window window)
  571.        (type (or (member :none :parent-relative) pixel pixmap) background)))
  572.  
  573. (defsetf window-border (window) (border)
  574.   (declare (type window window)
  575.        (type (or (member :copy) pixel pixmap) border)))
  576.  
  577. (defun window-gravity (window)
  578.   ;; setf'able
  579.   (declare (type window window)
  580.        (values win-gravity)))
  581.  
  582. (defun window-bit-gravity (window)
  583.   ;; setf'able
  584.   (declare (type window window)
  585.        (values bit-gravity)))
  586.  
  587. (defun window-backing-store (window)
  588.   ;; setf'able
  589.   (declare (type window window)
  590.        (values (member :not-useful :when-mapped :always))))
  591.  
  592. (defun window-backing-planes (window)
  593.   ;; setf'able
  594.   (declare (type window window)
  595.        (values pixel)))
  596.  
  597. (defun window-backing-pixel (window)
  598.   ;; setf'able
  599.   (declare (type window window)
  600.        (values pixel)))
  601.  
  602. (defun window-save-under (window)
  603.   ;; setf'able
  604.   (declare (type window window)
  605.        (values (member :on :off))))
  606.  
  607. (defun window-event-mask (window)
  608.   ;; setf'able
  609.   (declare (type window window)
  610.        (values mask32)))
  611.  
  612. (defun window-do-not-propagate-mask (window)
  613.   ;; setf'able
  614.   (declare (type window window)
  615.        (values mask32)))
  616.  
  617. (defun window-override-redirect (window)
  618.   ;; setf'able
  619.   (declare (type window window)
  620.        (values (member :on :off))))
  621.  
  622. (defun window-colormap (window)
  623.   (declare (type window window)
  624.        (values (or null colormap))))
  625.  
  626. (defsetf window-colormap (window) (colormap)
  627.   (declare (type window window)
  628.        (type (or (member :copy) colormap) colormap)))
  629.  
  630. (defsetf window-cursor (window) (cursor)
  631.   (declare (type window window)
  632.        (type (or (member :none) cursor) cursor)))
  633.  
  634. (defun window-colormap-installed-p (window)
  635.   (declare (type window window)
  636.        (values boolean)))
  637.  
  638. (defun window-all-event-masks (window)
  639.   (declare (type window window)
  640.        (values mask32)))
  641.  
  642. (defun window-map-state (window)
  643.   (declare (type window window)
  644.        (values (member :unmapped :unviewable :viewable))))
  645.  
  646. (defsetf drawable-x (window) (x)
  647.   (declare (type window window)
  648.        (type int16 x)))
  649.  
  650. (defsetf drawable-y (window) (y)
  651.   (declare (type window window)
  652.        (type int16 y)))
  653.  
  654. (defsetf drawable-width (window) (width)
  655.   ;; Inside width, excluding border.
  656.   (declare (type window window)
  657.        (type card16 width)))
  658.  
  659. (defsetf drawable-height (window) (height)
  660.   ;; Inside height, excluding border.
  661.   (declare (type window window)
  662.        (type card16 height)))
  663.  
  664. (defsetf drawable-border-width (window) (border-width)
  665.   (declare (type window window)
  666.        (type card16 border-width)))
  667.  
  668. (defsetf window-priority (window &optional sibling) (mode)
  669.   ;; A bit strange, but retains setf form.
  670.   (declare (type window window)
  671.        (type (or null window) sibling)
  672.        (type (member :above :below :top-if :bottom-if :opposite) mode)))
  673.  
  674. (defmacro with-state ((drawable) &body body)
  675.   ;; Allows a consistent view to be obtained of data returned by GetWindowAttributes
  676.   ;; and GetGeometry, and allows a coherent update using ChangeWindowAttributes and
  677.   ;; ConfigureWindow.  The body is not surrounded by a with-display.  Within the
  678.   ;; indefinite scope of the body, on a per-process basis in a multi-process
  679.   ;; environment, the first call within an Accessor Group on the specified drawable
  680.   ;; (the object, not just the variable) causes the complete results of the protocol
  681.   ;; request to be retained, and returned in any subsequent accessor calls.  Calls
  682.   ;; within a Setf Group are delayed, and executed in a single request on exit from
  683.   ;; the body.  In addition, if a call on a function within an Accessor Group follows
  684.   ;; a call on a function in the corresponding Setf Group, then all delayed setfs for
  685.   ;; that group are executed, any retained accessor information for that group is
  686.   ;; discarded, the corresponding protocol request is (re)issued, and the results are
  687.   ;; (again) retained, and returned in any subsequent accessor calls.
  688.  
  689.   ;; Accessor Group A (for GetWindowAttributes):
  690.   ;; window-visual-info, window-visual, window-class, window-gravity, window-bit-gravity,
  691.   ;; window-backing-store, window-backing-planes, window-backing-pixel,
  692.   ;; window-save-under, window-colormap, window-colormap-installed-p,
  693.   ;; window-map-state, window-all-event-masks, window-event-mask,
  694.   ;; window-do-not-propagate-mask, window-override-redirect
  695.  
  696.   ;; Setf Group A (for ChangeWindowAttributes):
  697.   ;; window-gravity, window-bit-gravity, window-backing-store, window-backing-planes,
  698.   ;; window-backing-pixel, window-save-under, window-event-mask,
  699.   ;; window-do-not-propagate-mask, window-override-redirect, window-colormap,
  700.   ;; window-cursor
  701.  
  702.   ;; Accessor Group G (for GetGeometry):
  703.   ;; drawable-root, drawable-depth, drawable-x, drawable-y, drawable-width,
  704.   ;; drawable-height, drawable-border-width
  705.  
  706.   ;; Setf Group G (for ConfigureWindow):
  707.   ;; drawable-x, drawable-y, drawable-width, drawable-height, drawable-border-width,
  708.   ;; window-priority
  709.   )
  710.  
  711. (defun destroy-window (window)
  712.   (declare (type window window)))
  713.  
  714. (defun destroy-subwindows (window)
  715.   (declare (type window window)))
  716.  
  717. (defun add-to-save-set (window)
  718.   (declare (type window window)))
  719.  
  720. (defun remove-from-save-set (window)
  721.   (declare (type window window)))
  722.  
  723. (defun reparent-window (window parent x y)
  724.   (declare (type window window parent)
  725.        (type int16 x y)))
  726.  
  727. (defun map-window (window)
  728.   (declare (type window window)))
  729.  
  730. (defun map-subwindows (window)
  731.   (declare (type window window)))
  732.  
  733. (defun unmap-window (window)
  734.   (declare (type window window)))
  735.  
  736. (defun unmap-subwindows (window)
  737.   (declare (type window window)))
  738.  
  739. (defun circulate-window-up (window)
  740.   (declare (type window window)))
  741.  
  742. (defun circulate-window-down (window)
  743.   (declare (type window window)))
  744.  
  745. (defun drawable-root (drawable)
  746.   (declare (type drawable drawable)
  747.        (values window)))
  748.  
  749. (defun drawable-depth (drawable)
  750.   (declare (type drawable drawable)
  751.        (values card8)))
  752.  
  753. (defun drawable-x (drawable)
  754.   (declare (type drawable drawable)
  755.        (values int16)))
  756.  
  757. (defun drawable-y (drawable)
  758.   (declare (type drawable drawable)
  759.        (values int16)))
  760.  
  761. (defun drawable-width (drawable)
  762.   ;; For windows, inside width, excluding border.
  763.   (declare (type drawable drawable)
  764.        (values card16)))
  765.  
  766. (defun drawable-height (drawable)
  767.   ;; For windows, inside height, excluding border.
  768.   (declare (type drawable drawable)
  769.        (values card16)))
  770.  
  771. (defun drawable-border-width (drawable)
  772.   (declare (type drawable drawable)
  773.        (values card16)))
  774.  
  775. (defun query-tree (window &key (result-type 'list))
  776.   (declare (type window window)
  777.        (type type result-type)
  778.        (values (sequence window) parent root)))
  779.  
  780. (defun change-property (window property data type format
  781.             &key (mode :replace) (start 0) end transform)
  782.   ;; Start and end affect sub-sequence extracted from data.
  783.   ;; Transform is applied to each extracted element.
  784.   (declare (type window window)
  785.        (type xatom property type)
  786.        (type (member 8 16 32) format)
  787.        (type sequence data)
  788.        (type (member :replace :prepend :append) mode)
  789.        (type array-index start)
  790.        (type (or null array-index) end)
  791.        (type (or null (function (t) integer)) transform)))
  792.  
  793. (defun delete-property (window property)
  794.   (declare (type window window)
  795.        (type xatom property)))
  796.  
  797. (defun get-property (window property
  798.              &key type (start 0) end delete-p (result-type 'list) transform)
  799.   ;; Transform is applied to each integer retrieved.
  800.   ;; Nil is returned for type when the protocol returns None.
  801.   (declare (type window window)
  802.        (type xatom property)
  803.        (type (or null xatom) type)
  804.        (type array-index start)
  805.        (type (or null array-index) end)
  806.        (type boolean delete-p)
  807.        (type type result-type)
  808.        (type (or null (function (integer) t)) transform)
  809.        (values data type format bytes-after)))
  810.  
  811. (defun rotate-properties (window properties &optional (delta 1))
  812.   ;; Postive rotates left, negative rotates right (opposite of actual protocol request).
  813.   (declare (type window window)
  814.        (type (sequence xatom) properties)
  815.        (type int16 delta)))
  816.  
  817. (defun list-properties (window &key (result-type 'list))
  818.   (declare (type window window)
  819.        (type type result-type)
  820.        (values (sequence keyword))))
  821.  
  822. ;; Although atom-ids are not visible in the normal user interface, atom-ids might
  823. ;; appear in window properties and other user data, so conversion hooks are needed.
  824.  
  825. (defun intern-atom (display name)
  826.   (declare (type display display)
  827.        (type xatom name)
  828.        (values resource-id)))
  829.  
  830. (defun find-atom (display name)
  831.   (declare (type display display)
  832.        (type xatom name)
  833.        (values (or null resource-id))))
  834.  
  835. (defun atom-name (display atom-id)
  836.   (declare (type display display)
  837.        (type resource-id atom-id)
  838.        (values keyword)))
  839.  
  840. (defun selection-owner (display selection)
  841.   (declare (type display display)
  842.        (type xatom selection)
  843.        (values (or null window))))
  844.  
  845. (defsetf selection-owner (display selection &optional time) (owner)
  846.   ;; A bit strange, but retains setf form.
  847.   (declare (type display display)
  848.        (type xatom selection)
  849.        (type (or null window) owner)
  850.        (type timestamp time)))
  851.  
  852. (defun convert-selection (selection type requestor &optional property time)
  853.   (declare (type xatom selection type)
  854.        (type window requestor)
  855.        (type (or null xatom) property)
  856.        (type timestamp time)))
  857.  
  858. (defun send-event (window event-key event-mask &rest args
  859.            &key propagate-p display &allow-other-keys)
  860.   ;; Additional arguments depend on event-key, and are as specified further below
  861.   ;; with declare-event, except that both resource-ids and resource objects are
  862.   ;; accepted in the event components.  The display argument is only required if the
  863.   ;; window is :pointer-window or :input-focus.  If an argument has synonyms, it is
  864.   ;; only necessary to supply a value for one of them; it is an error to specify
  865.   ;; different values for synonyms.
  866.   (declare (type (or window (member :pointer-window :input-focus)) window)
  867.        (type (or null event-key) event-key)
  868.        (type event-mask event-mask)
  869.        (type boolean propagate-p)
  870.        (type (or null display) display)))
  871.  
  872. (defun grab-pointer (window event-mask
  873.              &key owner-p sync-pointer-p sync-keyboard-p confine-to cursor time)
  874.   (declare (type window window)
  875.        (type pointer-event-mask event-mask)
  876.        (type boolean owner-p sync-pointer-p sync-keyboard-p)
  877.        (type (or null window) confine-to)
  878.        (type (or null cursor) cursor)
  879.        (type timestamp time)
  880.        (values grab-status)))
  881.  
  882. (defun ungrab-pointer (display &key time)
  883.   (declare (type display display)
  884.        (type timestamp time)))
  885.  
  886. (defun grab-button (window button event-mask
  887.             &key (modifiers 0)
  888.              owner-p sync-pointer-p sync-keyboard-p confine-to cursor)
  889.   (declare (type window window)
  890.        (type (or (member :any) card8) button)
  891.        (type modifier-mask modifiers)
  892.        (type pointer-event-mask event-mask)
  893.        (type boolean owner-p sync-pointer-p sync-keyboard-p)
  894.        (type (or null window) confine-to)
  895.        (type (or null cursor) cursor)))
  896.  
  897. (defun ungrab-button (window button &key (modifiers 0))
  898.   (declare (type window window)
  899.        (type (or (member :any) card8) button)
  900.        (type modifier-mask modifiers)))
  901.  
  902. (defun change-active-pointer-grab (display event-mask &optional cursor time)
  903.   (declare (type display display)
  904.        (type pointer-event-mask event-mask)
  905.        (type (or null cursor) cursor)
  906.        (type timestamp time)))
  907.  
  908. (defun grab-keyboard (window &key owner-p sync-pointer-p sync-keyboard-p time)
  909.   (declare (type window window)
  910.        (type boolean owner-p sync-pointer-p sync-keyboard-p)
  911.        (type timestamp time)
  912.        (values grab-status)))
  913.  
  914. (defun ungrab-keyboard (display &key time)
  915.   (declare (type display display)
  916.        (type timestamp time)))
  917.  
  918. (defun grab-key (window key &key (modifiers 0) owner-p sync-pointer-p sync-keyboard-p)
  919.   (declare (type window window)
  920.        (type boolean owner-p sync-pointer-p sync-keyboard-p)
  921.        (type (or (member :any) card8) key)
  922.        (type modifier-mask modifiers)))
  923.  
  924. (defun ungrab-key (window key &key (modifiers 0))
  925.   (declare (type window window)
  926.        (type (or (member :any) card8) key)
  927.        (type modifier-mask modifiers)))
  928.  
  929. (defun allow-events (display mode &optional time)
  930.   (declare (type display display)
  931.        (type (member :async-pointer :sync-pointer :reply-pointer
  932.              :async-keyboard :sync-keyboard :replay-keyboard
  933.              :async-both :sync-both)
  934.          mode)
  935.        (type timestamp time)))
  936.  
  937. (defun grab-server (display)
  938.   (declare (type display display)))
  939.  
  940. (defun ungrab-server (display)
  941.   (declare (type display display)))
  942.  
  943. (defmacro with-server-grabbed ((display) &body body)
  944.   ;; The body is not surrounded by a with-display.
  945.   )
  946.  
  947. (defun query-pointer (window)
  948.   (declare (type window window)
  949.        (values x y same-screen-p child mask root-x root-y root)))
  950.  
  951. (defun pointer-position (window)
  952.   (declare (type window window)
  953.        (values x y same-screen-p)))
  954.  
  955. (defun global-pointer-position (display)
  956.   (declare (type display display)
  957.        (values root-x root-y root)))
  958.  
  959. (defun motion-events (window &key start stop (result-type 'list))
  960.   (declare (type window window)
  961.        (type timestamp start stop)
  962.        (type type result-type)
  963.        (values (repeat-seq (int16 x) (int16 y) (timestamp time)))))
  964.  
  965. (defun translate-coordinates (src src-x src-y dst)
  966.   ;; If src and dst are not on the same screen, nil is returned.
  967.   (declare (type window src)
  968.        (type int16 src-x src-y)
  969.        (type window dst)
  970.        (values dst-x dst-y child)))
  971.  
  972. (defun warp-pointer (dst dst-x dst-y)
  973.   (declare (type window dst)
  974.        (type int16 dst-x dst-y)))
  975.  
  976. (defun warp-pointer-relative (display x-off y-off)
  977.   (declare (type display display)
  978.        (type int16 x-off y-off)))
  979.  
  980. (defun warp-pointer-if-inside (dst dst-x dst-y src src-x src-y
  981.                    &optional src-width src-height)
  982.   ;; Passing in a zero src-width or src-height is a no-op.  A null src-width or
  983.   ;; src-height translates into a zero value in the protocol request.
  984.   (declare (type window dst src)
  985.        (type int16 dst-x dst-y src-x src-y)
  986.        (type (or null card16) src-width src-height)))
  987.  
  988. (defun warp-pointer-relative-if-inside (x-off y-off src src-x src-y
  989.                     &optional src-width src-height)
  990.   ;; Passing in a zero src-width or src-height is a no-op.  A null src-width or
  991.   ;; src-height translates into a zero value in the protocol request.
  992.   (declare (type window src)
  993.        (type int16 x-off y-off src-x src-y)
  994.        (type (or null card16) src-width src-height)))
  995.  
  996. (defun set-input-focus (display focus revert-to &optional time)
  997.   ;; Setf ought to allow multiple values.
  998.   (declare (type display display)
  999.        (type (or (member :none :pointer-root) window) focus)
  1000.        (type (member :none :parent :pointer-root) revert-to)
  1001.        (type timestamp time)))
  1002.  
  1003. (defun input-focus (display)
  1004.   (declare (type display display)
  1005.        (values focus revert-to)))
  1006.  
  1007. (defun query-keymap (display)
  1008.   (declare (type display display)
  1009.        (values (bit-vector 256))))
  1010.  
  1011. (defun open-font (display name)
  1012.   ;; Font objects may be cached and reference counted locally within the display
  1013.   ;; object.  This function might not execute a with-display if the font is cached.
  1014.   ;; The protocol QueryFont request happens on-demand under the covers.
  1015.   (declare (type display display)
  1016.        (type stringable name)
  1017.        (values font)))
  1018.  
  1019. ;; We probably want a per-font bit to indicate whether caching on
  1020. ;; text-extents/width calls is desirable.  But what to name it?
  1021.  
  1022. (defun discard-font-info (font)
  1023.   ;; Discards any state that can be re-obtained with QueryFont.  This is simply
  1024.   ;; a performance hint for memory-limited systems.
  1025.   (declare (type font font)))
  1026.  
  1027. ;; This can be signalled anywhere a pseudo font access fails.
  1028.  
  1029. (define-condition invalid-font error
  1030.   font)
  1031.  
  1032. ;; Note: font-font-info removed.
  1033.  
  1034. (defun font-name (font)
  1035.   ;; Returns nil for a pseudo font returned by gcontext-font.
  1036.   (declare (type font font)
  1037.        (values (or null string))))
  1038.  
  1039. (defun font-direction (font)
  1040.   (declare (type font font)
  1041.        (values draw-direction)))
  1042.  
  1043. (defun font-min-char (font)
  1044.   (declare (type font font)
  1045.        (values card16)))
  1046.  
  1047. (defun font-max-char (font)
  1048.   (declare (type font font)
  1049.        (values card16)))
  1050.  
  1051. (defun font-min-byte1 (font)
  1052.   (declare (type font font)
  1053.        (values card8)))
  1054.  
  1055. (defun font-max-byte1 (font)
  1056.   (declare (type font font)
  1057.        (values card8)))
  1058.  
  1059. (defun font-min-byte2 (font)
  1060.   (declare (type font font)
  1061.        (values card8)))
  1062.  
  1063. (defun font-max-byte2 (font)
  1064.   (declare (type font font)
  1065.        (values card8)))
  1066.  
  1067. (defun font-all-chars-exist-p (font)
  1068.   (declare (type font font)
  1069.        (values boolean)))
  1070.  
  1071. (defun font-default-char (font)
  1072.   (declare (type font font)
  1073.        (values card16)))
  1074.  
  1075. (defun font-ascent (font)
  1076.   (declare (type font font)
  1077.        (values int16)))
  1078.  
  1079. (defun font-descent (font)
  1080.   (declare (type font font)
  1081.        (values int16)))
  1082.  
  1083. ;; The list contains alternating keywords and int32s.
  1084.  
  1085. (deftype font-props () 'list)
  1086.  
  1087. (defun font-properties (font)
  1088.   (declare (type font font)
  1089.        (values font-props)))
  1090.  
  1091. (defun font-property (font name)
  1092.   (declare (type font font)
  1093.        (type keyword name)
  1094.        (values (or null int32))))
  1095.  
  1096. ;; For each of left-bearing, right-bearing, width, ascent, descent, attributes:
  1097.  
  1098. (defun char-<metric> (font index)
  1099.   ;; Note: I have tentatively chosen to return nil for an out-of-bounds index
  1100.   ;; (or an in-bounds index on a pseudo font), although returning zero or
  1101.   ;; signalling might be better.
  1102.   (declare (type font font)
  1103.        (type card16 index)
  1104.        (values (or null int16))))
  1105.  
  1106. (defun max-char-<metric> (font)
  1107.   ;; Note: I have tentatively chosen separate accessors over allowing :min and
  1108.   ;; :max as an index above.
  1109.   (declare (type font font)
  1110.        (values int16)))
  1111.  
  1112. (defun min-char-<metric> (font)
  1113.   (declare (type font font)
  1114.        (values int16)))
  1115.  
  1116. ;; Note: char16-<metric> accessors could be defined to accept two-byte indexes.
  1117.  
  1118. (defun close-font (font)
  1119.   ;; This might not generate a protocol request if the font is reference
  1120.   ;; counted locally or if it is a pseudo font.
  1121.   (declare (type font font)))
  1122.  
  1123. (defun list-font-names (display pattern &key (max-fonts 65535) (result-type 'list))
  1124.   (declare (type display display)
  1125.        (type string pattern)
  1126.        (type card16 max-fonts)
  1127.        (type type result-type)
  1128.        (values (sequence string))))
  1129.  
  1130. (defun list-fonts (display pattern &key (max-fonts 65535) (result-type 'list))
  1131.   ;; Returns "pseudo" fonts that contain basic font metrics and properties, but
  1132.   ;; no per-character metrics and no resource-ids.  These pseudo fonts will be
  1133.   ;; converted (internally) to real fonts dynamically as needed, by issuing an
  1134.   ;; OpenFont request.  However, the OpenFont might fail, in which case the
  1135.   ;; invalid-font error can arise.
  1136.   (declare (type display display)
  1137.        (type string pattern)
  1138.        (type card16 max-fonts)
  1139.        (type type result-type)
  1140.        (values (sequence font))))
  1141.  
  1142. (defun font-path (display &key (result-type 'list))
  1143.   (declare (type display display)
  1144.        (type type result-type)
  1145.        (values (sequence (or string pathname)))))
  1146.  
  1147. (defsetf font-path (display) (paths)
  1148.   (declare (type display display)
  1149.        (type (sequence (or string pathname)) paths)))
  1150.  
  1151. (defun create-pixmap (&key width height depth drawable)
  1152.   (declare (type card16 width height)
  1153.        (type card8 depth)
  1154.        (type drawable drawable)
  1155.        (values pixmap)))
  1156.  
  1157. (defun free-pixmap (pixmap)
  1158.   (declare (type pixmap pixmap)))
  1159.  
  1160. (defun create-gcontext (&key drawable function plane-mask foreground background
  1161.                  line-width line-style cap-style join-style fill-style fill-rule
  1162.                  arc-mode tile stipple ts-x ts-y font subwindow-mode
  1163.                  exposures clip-x clip-y clip-mask clip-ordering
  1164.                  dash-offset dashes
  1165.                  (cache-p t))
  1166.   ;; Only non-nil components are passed on in the request, but for effective caching
  1167.   ;; assumptions have to be made about what the actual protocol defaults are.  For
  1168.   ;; all gcontext components, a value of nil causes the default gcontext value to be
  1169.   ;; used.  For clip-mask, this implies that an empty rect-seq cannot be represented
  1170.   ;; as a list.  Note:  use of stringable as font will cause an implicit open-font.
  1171.   ;; Note:  papers over protocol SetClipRectangles and SetDashes special cases.  If
  1172.   ;; cache-p is true, then gcontext state is cached locally, and changing a gcontext
  1173.   ;; component will have no effect unless the new value differs from the cached
  1174.   ;; value.  Component changes (setfs and with-gcontext) are always deferred
  1175.   ;; regardless of the cache mode, and sent over the protocol only when required by a
  1176.   ;; local operation or by an explicit call to force-gcontext-changes.
  1177.   (declare (type drawable drawable)
  1178.        (type (or null boole-constant) function)
  1179.        (type (or null pixel) plane-mask foreground background)
  1180.        (type (or null card16) line-width dash-offset)
  1181.        (type (or null int16) ts-x ts-y clip-x clip-y)
  1182.        (type (or null (member :solid :dash :double-dash)) line-style)
  1183.        (type (or null (member :not-last :butt :round :projecting)) cap-style)
  1184.        (type (or null (member :miter :round :bevel)) join-style)
  1185.        (type (or null (member :solid :tiled :opaque-stippled :stippled)) fill-style)
  1186.        (type (or null (member :even-odd :winding)) fill-rule)
  1187.        (type (or null (member :chord :pie-slice)) arc-mode)
  1188.        (type (or null pixmap) tile stipple)
  1189.        (type (or null fontable) font)
  1190.        (type (or null (member :clip-by-children :include-inferiors)) subwindow-mode)
  1191.        (type (or null (member :on :off)) exposures)
  1192.        (type (or null (member :none) pixmap rect-seq) clip-mask)
  1193.        (type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
  1194.        (type (or null (or card8 (sequence card8))) dashes)
  1195.        (type boolean cache)
  1196.        (values gcontext)))
  1197.  
  1198. ;; For each argument to create-gcontext (except font, clip-mask and
  1199. ;; clip-ordering) declared as (type <type> <name>), there is an accessor:
  1200.  
  1201. (defun gcontext-<name> (gcontext)
  1202.   ;; The value will be nil if the last value stored is unknown (e.g., the cache was
  1203.   ;; off, or the component was copied from a gcontext with unknown state).
  1204.   (declare (type gcontext gcontext)
  1205.        (values <type>)))
  1206.  
  1207. ;; For each argument to create-gcontext (except clip-mask and clip-ordering) declared
  1208. ;; as (type (or null <type>) <name>), there is a setf for the corresponding accessor:
  1209.  
  1210. (defsetf gcontext-<name> (gcontext) (value)
  1211.   (declare (type gcontext gcontext)
  1212.        (type <type> value)))
  1213.  
  1214. (defun gcontext-font (gcontext &optional metrics-p)
  1215.   ;; If the stored font is known, it is returned.  If it is not known and
  1216.   ;; metrics-p is false, then nil is returned.  If it is not known and
  1217.   ;; metrics-p is true, then a pseudo font is returned.  Full metric and
  1218.   ;; property information can be obtained, but the font does not have a name or
  1219.   ;; a resource-id, and attempts to use it where a resource-id is required will
  1220.   ;; result in an invalid-font error.
  1221.   (declare (type gcontext gcontext)
  1222.        (type boolean metrics-p)
  1223.        (values (or null font))))
  1224.  
  1225. (defun gcontext-clip-mask (gcontext)
  1226.   (declare (type gcontext gcontext)
  1227.        (values (or null (member :none) pixmap rect-seq)
  1228.            (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)))))
  1229.  
  1230. (defsetf gcontext-clip-mask (gcontext &optional ordering) (clip-mask)
  1231.   ;; Is nil illegal here, or is it transformed to a vector?
  1232.   ;; A bit strange, but retains setf form.
  1233.   (declare (type gcontext gcontext)
  1234.        (type (or null (member :unsorted :y-sorted :yx-sorted :yx-banded)) clip-ordering)
  1235.        (type (or (member :none) pixmap rect-seq) clip-mask)))
  1236.  
  1237. (defun force-gcontext-changes (gcontext)
  1238.   ;; Force any delayed changes.
  1239.   (declare (type gcontext gcontext)))
  1240.  
  1241. (defmacro with-gcontext ((gcontext &key
  1242.               function plane-mask foreground background
  1243.               line-width line-style cap-style join-style fill-style fill-rule
  1244.               arc-mode tile stipple ts-x ts-y font subwindow-mode
  1245.               exposures clip-x clip-y clip-mask clip-ordering
  1246.               dashes dash-offset)
  1247.              &body body)
  1248.   ;; Changes gcontext components within the dynamic scope of the body (i.e.,
  1249.   ;; indefinite scope and dynamic extent), on a per-process basis in a multi-process
  1250.   ;; environment.  The values are all evaluated before bindings are performed.  The
  1251.   ;; body is not surrounded by a with-display.  If cache-p is nil or the some
  1252.   ;; component states are unknown, this will implement save/restore by creating a
  1253.   ;; temporary gcontext and doing gcontext-components to and from it.
  1254.   )
  1255.  
  1256. (defun copy-gcontext-components (src dst &rest keys)
  1257.   (declare (type gcontext src dst)
  1258.        (type (list gcontext-key) keys)))
  1259.  
  1260. (defun copy-gcontext (src dst)
  1261.   (declare (type gcontext src dst))
  1262.   ;; Copies all components.
  1263.   )
  1264.        
  1265. (defun free-gcontext (gcontext)
  1266.   (declare (type gcontext gcontext)))
  1267.  
  1268. (defun clear-area (window &key (x 0) (y 0) width height exposures-p)
  1269.   ;; Passing in a zero width or height is a no-op.  A null width or height translates
  1270.   ;; into a zero value in the protocol request.
  1271.   (declare (type window window)
  1272.        (type int16 x y)
  1273.        (type (or null card16) width height)
  1274.        (type boolean exposures-p)))
  1275.  
  1276. (defun copy-area (src gcontext src-x src-y width height dst dst-x dst-y)
  1277.   (declare (type drawable src dst)
  1278.        (type gcontext gcontext)
  1279.        (type int16 src-x src-y dst-x dst-y)
  1280.        (type card16 width height)))
  1281.  
  1282. (defun copy-plane (src gcontext plane src-x src-y width height dst dst-x dst-y)
  1283.   (declare (type drawable src dst)
  1284.        (type gcontext gcontext)
  1285.        (type pixel plane)
  1286.        (type int16 src-x src-y dst-x dst-y)
  1287.        (type card16 width height)))
  1288.  
  1289. (defun draw-point (drawable gcontext x y)
  1290.   ;; Should be clever about appending to existing buffered protocol request, provided
  1291.   ;; gcontext has not been modified.
  1292.   (declare (type drawable drawable)
  1293.        (type gcontext gcontext)
  1294.        (type int16 x y)))
  1295.  
  1296. (defun draw-points (drawable gcontext points &optional relative-p)
  1297.   (declare (type drawable drawable)
  1298.        (type gcontext gcontext)
  1299.        (type point-seq points)
  1300.        (type boolean relative-p)))
  1301.  
  1302. (defun draw-line (drawable gcontext x1 y1 x2 y2 &optional relative-p)
  1303.   ;; Should be clever about appending to existing buffered protocol request, provided
  1304.   ;; gcontext has not been modified.
  1305.   (declare (type drawable drawable)
  1306.        (type gcontext gcontext)
  1307.        (type int16 x1 y1 x2 y2)
  1308.        (type boolean relative-p)))
  1309.  
  1310. (defun draw-lines (drawable gcontext points &key relative-p fill-p (shape :complex))
  1311.   (declare (type drawable drawable)
  1312.        (type gcontext gcontext)
  1313.        (type point-seq points)
  1314.        (type boolean relative-p fill-p)
  1315.        (type (member :complex :non-convex :convex) shape)))
  1316.  
  1317. (defun draw-segments (drawable gcontext segments)
  1318.   (declare (type drawable drawable)
  1319.        (type gcontext gcontext)
  1320.        (type seg-seq segments)))
  1321.  
  1322. (defun draw-rectangle (drawable gcontext x y width height &optional fill-p)
  1323.   ;; Should be clever about appending to existing buffered protocol request, provided
  1324.   ;; gcontext has not been modified.
  1325.   (declare (type drawable drawable)
  1326.        (type gcontext gcontext)
  1327.        (type int16 x y)
  1328.        (type card16 width height)
  1329.        (type boolean fill-p)))
  1330.  
  1331. (defun draw-rectangles (drawable gcontext rectangles &optional fill-p)
  1332.   (declare (type drawable drawable)
  1333.        (type gcontext gcontext)
  1334.        (type rect-seq rectangles)
  1335.        (type boolean fill-p)))
  1336.  
  1337. (defun draw-arc (drawable gcontext x y width height angle1 angle2 &optional fill-p)
  1338.   ;; Should be clever about appending to existing buffered protocol request, provided
  1339.   ;; gcontext has not been modified.
  1340.   (declare (type drawable drawable)
  1341.        (type gcontext gcontext)
  1342.        (type int16 x y)
  1343.        (type card16 width height)
  1344.        (type angle angle1 angle2)
  1345.        (type boolean fill-p)))
  1346.  
  1347. (defun draw-arcs (drawable gcontext arcs &optional fill-p)
  1348.   (declare (type drawable drawable)
  1349.        (type gcontext gcontext)
  1350.        (type arc-seq arcs)
  1351.        (type boolean fill-p)))
  1352.  
  1353. ;; The following image routines are bare minimum.  It may be useful to define some
  1354. ;; form of "image" object to hide representation details and format conversions.  It
  1355. ;; also may be useful to provide stream-oriented interfaces for reading and writing
  1356. ;; the data.
  1357.  
  1358. (defun put-raw-image (drawable gcontext data
  1359.               &key (start 0) depth x y width height (left-pad 0) format)
  1360.   ;; Data must be a sequence of 8-bit quantities, already in the appropriate format
  1361.   ;; for transmission; the caller is responsible for all byte and bit swapping and
  1362.   ;; compaction.  Start is the starting index in data; the end is computed from the
  1363.   ;; other arguments.
  1364.   (declare (type drawable drawable)
  1365.        (type gcontext gcontext)
  1366.        (type (sequence card8) data)
  1367.        (type array-index start)
  1368.        (type card8 depth left-pad)
  1369.        (type int16 x y)
  1370.        (type card16 width height)
  1371.        (type (member :bitmap :xy-pixmap :z-pixmap) format)))
  1372.  
  1373. (defun get-raw-image (drawable &key data (start 0) x y width height
  1374.                     (plane-mask 0xffffffff) format
  1375.                     (result-type '(vector (unsigned-byte 8))))
  1376.   ;; If data is given, it is modified in place (and returned), otherwise a new
  1377.   ;; sequence is created and returned, with a size computed from the other arguments
  1378.   ;; and the returned depth.  The sequence is filled with 8-bit quantities, in
  1379.   ;; transmission format; the caller is responsible for any byte and bit swapping and
  1380.   ;; compaction required for further local use.
  1381.   (declare (type drawable drawable)
  1382.        (type (or null (sequence card8)) data)
  1383.        (type array-index start)
  1384.        (type int16 x y)
  1385.        (type card16 width height)
  1386.        (type pixel plane-mask)
  1387.        (type (member :xy-pixmap :z-pixmap) format)
  1388.        (values (sequence card8) depth visual-info)))
  1389.  
  1390. (defun translate-default (src src-start src-end font dst dst-start)
  1391.   ;; dst is guaranteed to have room for (- src-end src-start) integer elements,
  1392.   ;; starting at dst-start; whether dst holds 8-bit or 16-bit elements depends
  1393.   ;; on context.  font is the current font, if known.  The function should
  1394.   ;; translate as many elements of src as possible into indexes in the current
  1395.   ;; font, and store them into dst.  The first return value should be the src
  1396.   ;; index of the first untranslated element.  If no further elements need to
  1397.   ;; be translated, the second return value should be nil.  If a horizontal
  1398.   ;; motion is required before further translation, the second return value
  1399.   ;; should be the delta in x coordinate.  If a font change is required for
  1400.   ;; further translation, the second return value should be the new font.  If
  1401.   ;; known, the pixel width of the translated text can be returned as the third
  1402.   ;; value; this can allow for appending of subsequent output to the same
  1403.   ;; protocol request, if no overall width has been specified at the higher
  1404.   ;; level.
  1405.   (declare (type sequence src)
  1406.        (type array-index src-start src-end dst-start)
  1407.        (type (or null font) font)
  1408.        (type vector dst)
  1409.        (values array-index (or null int16 font) (or null int32))))
  1410.  
  1411. ;; There is a question below of whether translate should always be required, or
  1412. ;; if not, what the default should be or where it should come from.  For
  1413. ;; example, the default could be something that expected a string as src and
  1414. ;; translated the CL standard character set to ASCII indexes, and ignored fonts
  1415. ;; and bits.  Or the default could expect a string but otherwise be "system
  1416. ;; dependent".  Or the default could be something that expected a vector of
  1417. ;; integers and did no translation.  Or the default could come from the
  1418. ;; gcontext (but what about text-extents and text-width?).
  1419.  
  1420. (defun text-extents (font sequence &key (start 0) end translate)
  1421.   ;; If multiple fonts are involved, font-ascent and font-descent will be the
  1422.   ;; maximums.  If multiple directions are involved, the direction will be nil.
  1423.   ;; Translate will always be called with a 16-bit dst buffer.
  1424.   (declare (type sequence sequence)
  1425.        (type (or font gcontext) font)
  1426.        (type translate translate)
  1427.        (values width ascent descent left right font-ascent font-descent direction
  1428.            (or null array-index))))
  1429.  
  1430. (defun text-width (font sequence &key (start 0) end translate)
  1431.   ;; Translate will always be called with a 16-bit dst buffer.
  1432.   (declare (type sequence sequence)
  1433.        (type (or font gcontext) font)
  1434.        (type translate translate)
  1435.        (values int32 (or null array-index))))
  1436.  
  1437. ;; This controls the element size of the dst buffer given to translate.  If
  1438. ;; :default is specified, the size will be based on the current font, if known,
  1439. ;; and otherwise 16 will be used.  [An alternative would be to pass the buffer
  1440. ;; size to translate, and allow it to return the desired size if it doesn't
  1441. ;; like the current size.  The problem is that the protocol doesn't allow
  1442. ;; switching within a single request, so to allow switching would require
  1443. ;; knowing the width of text, which isn't necessarily known.  We could call
  1444. ;; text-width to compute it, but perhaps that is doing too many favors?]  [An
  1445. ;; additional possibility is to allow an index-size of :two-byte, in which case
  1446. ;; translate would be given a double-length 8-bit array, and translate would be
  1447. ;; expected to store first-byte/second-byte instead of 16-bit integers.]
  1448.  
  1449. (deftype index-size () '(member :default 8 16))
  1450.  
  1451. ;; In the glyph functions below, if width is specified, it is assumed to be the
  1452. ;; total pixel width of whatever string of glyphs is actually drawn.
  1453. ;; Specifying width will allow for appending the output of subsequent calls to
  1454. ;; the same protocol request, provided gcontext has not been modified in the
  1455. ;; interim.  If width is not specified, appending of subsequent output might
  1456. ;; not occur (unless translate returns the width).  Specifying width is simply
  1457. ;; a hint, for performance.
  1458.  
  1459. (defun draw-glyph (drawable gcontext x y elt
  1460.            &key translate width (size :default))
  1461.   ;; Returns true if elt is output, nil if translate refuses to output it.
  1462.   ;; Second result is width, if known.
  1463.   (declare (type drawable drawable)
  1464.        (type gcontext gcontext)
  1465.        (type int16 x y)
  1466.        (type translate translate)
  1467.        (type (or null int32) width)
  1468.        (type index-size size)
  1469.        (values boolean (or null int32))))
  1470.  
  1471. (defun draw-glyphs (drawable gcontext x y sequence
  1472.             &key (start 0) end translate width (size :default))
  1473.   ;; First result is new start, if end was not reached.  Second result is
  1474.   ;; overall width, if known.
  1475.   (declare (type drawable drawable)
  1476.        (type gcontext gcontext)
  1477.        (type int16 x y)
  1478.        (type sequence sequence)
  1479.        (type array-index start)
  1480.        (type (or null array-index) end)
  1481.        (type (or null int32) width)
  1482.        (type translate translate)
  1483.        (type index-size size)
  1484.        (values (or null array-index) (or null int32))))
  1485.  
  1486. (defun draw-image-glyph (drawable gcontext x y elt
  1487.              &key translate width (size :default))
  1488.   ;; Returns true if elt is output, nil if translate refuses to output it.
  1489.   ;; Second result is overall width, if known.  An initial font change is
  1490.   ;; allowed from translate.
  1491.   (declare (type drawable drawable)
  1492.        (type gcontext gcontext)
  1493.        (type int16 x y)
  1494.        (type translate translate)
  1495.        (type (or null int32) width)
  1496.        (type index-size size)
  1497.        (values boolean (or null int32))))
  1498.  
  1499. (defun draw-image-glyphs (drawable gcontext x y sequence
  1500.               &key (start 0) end width translate (size :default))
  1501.   ;; An initial font change is allowed from translate, but any subsequent font
  1502.   ;; change or horizontal motion will cause termination (because the protocol
  1503.   ;; doesn't support chaining).  [Alternatively, font changes could be accepted
  1504.   ;; as long as they are accompanied with a width return value, or always
  1505.   ;; accept font changes and call text-width as required.  However, horizontal
  1506.   ;; motion can't really be accepted, due to semantics.]  First result is new
  1507.   ;; start, if end was not reached.  Second result is overall width, if known.
  1508.   (declare (type drawable drawable)
  1509.        (type gcontext gcontext)
  1510.        (type int16 x y)
  1511.        (type sequence sequence)
  1512.        (type array-index start)
  1513.        (type (or null array-index) end)
  1514.        (type (or null int32) width)
  1515.        (type translate translate)
  1516.        (type index-size size)
  1517.        (values (or null array-index) (or null int32))))
  1518.  
  1519. (defun create-colormap (visual window &optional alloc-p)
  1520.   (declare (type visual-info visual)
  1521.        (type window window)
  1522.        (type boolean alloc-p)
  1523.        (values colormap)))
  1524.  
  1525. (defun free-colormap (colormap)
  1526.   (declare (type colormap colormap)))
  1527.  
  1528. (defun copy-colormap-and-free (colormap)
  1529.   (declare (type colormap colormap)
  1530.        (values colormap)))
  1531.  
  1532. (defun install-colormap (colormap)
  1533.   (declare (type colormap colormap)))
  1534.  
  1535. (defun uninstall-colormap (colormap)
  1536.   (declare (type colormap colormap)))
  1537.  
  1538. (defun installed-colormaps (window &key (result-type 'list))
  1539.   (declare (type window window)
  1540.        (type type result-type)
  1541.        (values (sequence colormap))))
  1542.  
  1543. (defun alloc-color (colormap color)
  1544.   (declare (type colormap colormap)
  1545.        (type (or stringable color) color)
  1546.        (values pixel screen-color exact-color)))
  1547.  
  1548. (defun alloc-color-cells (colormap colors &key (planes 0) contiguous-p (result-type 'list))
  1549.   (declare (type colormap colormap)
  1550.        (type card16 colors planes)
  1551.        (type boolean contiguous-p)
  1552.        (type type result-type)
  1553.        (values (sequence pixel) (sequence mask))))
  1554.  
  1555. (defun alloc-color-planes (colormap colors
  1556.                &key (reds 0) (greens 0) (blues 0)
  1557.                 contiguous-p (result-type 'list))
  1558.   (declare (type colormap colormap)
  1559.        (type card16 colors reds greens blues)
  1560.        (type boolean contiguous-p)
  1561.        (type type result-type)
  1562.        (values (sequence pixel) red-mask green-mask blue-mask)))
  1563.  
  1564. (defun free-colors (colormap pixels &optional (plane-mask 0))
  1565.   (declare (type colormap colormap)
  1566.        (type (sequence pixel) pixels)
  1567.        (type pixel plane-mask)))
  1568.  
  1569. (defun store-color (colormap pixel spec &key (red-p t) (green-p t) (blue-p t))
  1570.   (declare (type colormap colormap)
  1571.        (type pixel pixel)
  1572.        (type (or stringable color) spec)
  1573.        (type boolean red-p green-p blue-p)))
  1574.  
  1575. (defun store-colors (colormap specs &key (red-p t) (green-p t) (blue-p t))
  1576.   ;; If stringables are specified for colors, it is unspecified whether all
  1577.   ;; stringables are first resolved and then a single StoreColors protocol request is
  1578.   ;; issued, or whether multiple StoreColors protocol requests are issued.
  1579.   (declare (type colormap colormap)
  1580.        (type (repeat-seq (pixel pixel) ((or stringable color) color)) specs)
  1581.        (type boolean red-p green-p blue-p)))
  1582.  
  1583. (defun query-colors (colormap pixels &key (result-type 'list))
  1584.   (declare (type colormap colormap)
  1585.        (type (sequence pixel) pixels)
  1586.        (type type result-type)
  1587.        (values (sequence color))))
  1588.  
  1589. (defun lookup-color (colormap name)
  1590.   (declare (type colormap colormap)
  1591.        (type stringable name)
  1592.        (values screen-color true-color)))
  1593.  
  1594. (defun create-cursor (&key source mask x y foreground background)
  1595.   (declare (type pixmap source)
  1596.        (type (or null pixmap) mask)
  1597.        (type card16 x y)
  1598.        (type color foreground background)
  1599.        (values cursor)))
  1600.  
  1601. (defun create-glyph-cursor (&key source-font source-char mask-font mask-char
  1602.                  foreground background)
  1603.   (declare (type font source-font)
  1604.        (type card16 source-char)
  1605.        (type (or null font) mask-font)
  1606.        (type (or null card16) mask-char)
  1607.        (type color foreground background)
  1608.        (values cursor)))
  1609.  
  1610. (defun free-cursor (cursor)
  1611.   (declare (type cursor cursor)))
  1612.  
  1613. (defun recolor-cursor (cursor foreground background)
  1614.   (declare (type cursor cursor)
  1615.        (type color foreground background)))
  1616.  
  1617. (defun query-best-cursor (width height drawable)
  1618.   (declare (type card16 width height)
  1619.        (type drawable display)
  1620.        (values width height)))
  1621.  
  1622. (defun query-best-tile (width height drawable)
  1623.   (declare (type card16 width height)
  1624.        (type drawable drawable)
  1625.        (values width height)))
  1626.  
  1627. (defun query-best-stipple (width height drawable)
  1628.   (declare (type card16 width height)
  1629.        (type drawable drawable)
  1630.        (values width height)))
  1631.  
  1632. (defun query-extension (display name)
  1633.   (declare (type display display)
  1634.        (type stringable name)
  1635.        (values major-opcode first-event first-error)))
  1636.  
  1637. (defun list-extensions (display &key (result-type 'list))
  1638.   (declare (type display display)
  1639.        (type type result-type)
  1640.        (values (sequence string))))
  1641.  
  1642. ;; Should pointer-mapping setf be changed to set-pointer-mapping?
  1643.  
  1644. (defun set-modifier-mapping (display &key shift lock control mod1 mod2 mod3 mod4 mod5)
  1645.   ;; Can signal device-busy.
  1646.   ;; Setf ought to allow multiple values.
  1647.   ;; Returns true for success, nil for failure
  1648.   (declare (type display display)
  1649.        (type (sequence card8) shift lock control mod1 mod2 mod3 mod4 mod5)
  1650.        (values (member :success :busy :failed))))
  1651.  
  1652. (defun modifier-mapping (display)
  1653.   ;; each value is a list of card8s
  1654.   (declare (type display display)
  1655.        (values shift lock control mod1 mod2 mod3 mod4 mod5)))
  1656.  
  1657. ;; Either we will want lots of defconstants for well-known values, or perhaps
  1658. ;; an integer-to-keyword translation function for well-known values.
  1659.  
  1660. (defun change-keyboard-mapping (display keysyms
  1661.                 &key (start 0) end (first-keycode start))
  1662.   ;; start/end give subrange of keysyms
  1663.   ;; first-keycode is the first-keycode to store at
  1664.   (declare (type display display)
  1665.        (type (array * (* *)) keysyms)
  1666.        (type array-index start)
  1667.        (type (or null array-index) end)
  1668.        (type card8 first-keycode)))
  1669.  
  1670. (defun keyboard-mapping (display &key first-keycode start end data)
  1671.   ;; First-keycode specifies which keycode to start at (defaults to
  1672.   ;; min-keycode).  Start specifies where (in result) to put first-keycode
  1673.   ;; (defaults to first-keycode).  (- end start) is the number of keycodes to
  1674.   ;; get (end defaults to (1+ max-keycode)).  If data is specified, the results
  1675.   ;; are put there.
  1676.   (declare (type display display)
  1677.        (type (or null card8) first-keycode)
  1678.        (type (or null array-index) start end)
  1679.        (type (or null (array * (* *))) data)
  1680.        (values (array * (* *)))))
  1681.  
  1682. (defun change-keyboard-control (display &key key-click-percent
  1683.                 bell-percent bell-pitch bell-duration
  1684.                 led led-mode key auto-repeat-mode)
  1685.   (declare (type display display)
  1686.        (type (or null (member :default) int16) key-click-percent
  1687.                            bell-percent bell-pitch bell-duration)
  1688.        (type (or null card8) led key)
  1689.        (type (or null (member :on :off)) led-mode)
  1690.        (type (or null (member :on :off :default)) auto-repeat-mode)))
  1691.  
  1692. (defun keyboard-control (display)
  1693.   (declare (type display display)
  1694.        (values key-click-percent bell-percent bell-pitch bell-duration
  1695.            led-mask global-auto-repeat auto-repeats)))
  1696.  
  1697. (defun bell (display &optional (percent-from-normal 0))
  1698.   ;; It is assumed that an eventual audio extension to X will provide more complete
  1699.   ;; control.
  1700.   (declare (type display display)
  1701.        (type int8 percent-from-normal)))
  1702.  
  1703. (defun pointer-mapping (display &key (result-type 'list))
  1704.   (declare (type display display)
  1705.        (type type result-type)
  1706.        (values (sequence card8))))
  1707.  
  1708. (defsetf pointer-mapping (display) (map)
  1709.   ;; Can signal device-busy.
  1710.   (declare (type display display)
  1711.        (type (sequence card8) map)))
  1712.  
  1713. (defun change-pointer-control (display &key acceleration threshold)
  1714.   ;; Acceleration is rationalized if necessary.
  1715.   (declare (type display display)
  1716.        (type (or null (member :default) number) acceleration)
  1717.        (type (or null (member :default) integer) threshold)))
  1718.  
  1719. (defun pointer-control (display)
  1720.   (declare (type display display)
  1721.        (values acceleration threshold)))
  1722.  
  1723. (defun set-screen-saver (display timeout interval blanking exposures)
  1724.   ;; Setf ought to allow multiple values.
  1725.   ;; Timeout and interval are in seconds, will be rounded to minutes.
  1726.   (declare (type display display)
  1727.        (type (or (member :default) int16) timeout interval)
  1728.        (type (member :on :off :default) blanking exposures)))
  1729.  
  1730. (defun screen-saver (display)
  1731.   ;; Returns timeout and interval in seconds.
  1732.   (declare (type display display)
  1733.        (values timeout interval blanking exposures)))
  1734.  
  1735. (defun activate-screen-saver (display)
  1736.   (declare (type display display)))
  1737.  
  1738. (defun reset-screen-saver (display)
  1739.   (declare (type display display)))
  1740.  
  1741. (defun add-access-host (display host)
  1742.   ;; A string must be acceptable as a host, but otherwise the possible types for host
  1743.   ;; are not constrained, and will likely be very system dependent.
  1744.   (declare (type display display)))
  1745.  
  1746. (defun remove-access-host (display host)
  1747.   ;; A string must be acceptable as a host, but otherwise the possible types for host
  1748.   ;; are not constrained, and will likely be very system dependent.
  1749.   (declare (type display display)))
  1750.  
  1751. (defun access-hosts (display &key (result-type 'list))
  1752.   ;; The type of host objects returned is not constrained, except that the hosts must
  1753.   ;; be acceptable to add-access-host and remove-access-host.
  1754.   (declare (type display display)
  1755.        (type type result-type)
  1756.        (values (sequence host) enabled-p)))
  1757.  
  1758. (defun access-control (display)
  1759.   ;; setf'able
  1760.   (declare (type display display)
  1761.        (values boolean)))
  1762.  
  1763. (defun close-down-mode (display)
  1764.   ;; setf'able
  1765.   ;; Cached locally in display object.
  1766.   (declare (type display display)
  1767.        (values (member :destroy :retain-permanent :retain-temporary))))
  1768.  
  1769. (defun kill-client (display resource-id)
  1770.   (declare (type display display)
  1771.        (type resource-id resource-id)))
  1772.  
  1773. (defun kill-temporary-clients (display)
  1774.   (declare (type display display)))
  1775.  
  1776. (defun make-event-mask (&rest keys)
  1777.   ;; This is only defined for core events.
  1778.   ;; Useful for constructing event-mask, pointer-event-mask, device-event-mask.
  1779.   (declare (type (list event-mask-class) keys)
  1780.        (values mask32)))
  1781.  
  1782. (defun make-event-keys (event-mask)
  1783.   ;; This is only defined for core events.
  1784.   (declare (type mask32 event-mask)
  1785.        (values (list event-mask-class))))
  1786.  
  1787. (defun make-state-mask (&rest keys)
  1788.   ;; Useful for constructing modifier-mask, state-mask.
  1789.   (declare (type (list state-mask-key) keys)
  1790.        (values mask16)))
  1791.  
  1792. (defun make-state-keys (state-mask)
  1793.   (declare (type mask16 mask)
  1794.        (values (list state-mask-key))))
  1795.  
  1796. (defmacro with-event-queue ((display) &body body)
  1797.   ;; Grants exclusive access to event queue.
  1798.   )
  1799.  
  1800. (defun event-listen (display &optional (timeout 0))
  1801.   (declare (type display display)
  1802.        (type (or null number) timeout)
  1803.        (values (or null number) (or null (member :timeout) (not null))))
  1804.   ;; Returns the number of events queued locally, if any, else nil.  Hangs
  1805.   ;; waiting for events, forever if timeout is nil, else for the specified
  1806.   ;; number of seconds.  The second value returned is :timeout if the
  1807.   ;; operation timed out, and some other non-nil value if an EOF has been
  1808.   ;; detected.
  1809.   )
  1810.  
  1811. (defun process-event (display &key handler timeout peek-p discard-p (force-output-p t))
  1812.   ;; If force-output-p is true, first invokes display-force-output.  Invokes
  1813.   ;; handler on each queued event until handler returns non-nil, and that
  1814.   ;; returned object is then returned by process-event.  If peek-p is true,
  1815.   ;; then the event is not removed from the queue.  If discard-p is true, then
  1816.   ;; events for which handler returns nil are removed from the queue,
  1817.   ;; otherwise they are left in place.  Hangs until non-nil is generated for
  1818.   ;; some event, or for the specified timeout (in seconds, if given); however,
  1819.   ;; it is acceptable for an implementation to wait only once on network data,
  1820.   ;; and therefore timeout prematurely.  Returns nil on timeout or EOF, with a
  1821.   ;; second return value being :timeout for a timeout and some other non-nil
  1822.   ;; value for EOF.  If handler is a sequence, it is expected to contain
  1823.   ;; handler functions specific to each event class; the event code is used to
  1824.   ;; index the sequence, fetching the appropriate handler.  The arguments to
  1825.   ;; the handler are described further below using declare-event.  If
  1826.   ;; process-event is invoked recursively, the nested invocation begins with
  1827.   ;; the event after the one currently being processed.
  1828.   (declare (type display display)
  1829.        (type (or (sequence (function (&rest key-vals) t))
  1830.              (function (&rest key-vals) t))
  1831.          handler)
  1832.        (type (or null number) timeout)
  1833.        (type boolean peek-p)))
  1834.  
  1835. (defun make-event-handlers (&key (type 'array) default)
  1836.   (declare (type t type)            ;Sequence type specifier
  1837.        (type function default)
  1838.        (values sequence))            ;Default handler for initial content
  1839.   ;; Makes a handler sequence suitable for process-event
  1840.   )
  1841.    
  1842. (defun event-handler (handlers event-key)
  1843.   (declare (type sequence handlers)
  1844.        (type event-key event-key)
  1845.        (values function))
  1846.   ;; Accessor for a handler sequence
  1847.   )
  1848.  
  1849. (defsetf event-handler (handlers event-key) (handler)
  1850.   (declare (type sequence handlers)
  1851.        (type event-key event-key)
  1852.        (type function handler)
  1853.        (values function))
  1854.   ;; Setf accessor for a handler sequence
  1855.   )
  1856.  
  1857. (defmacro event-case ((display &key timeout peek-p discard-p (force-output-p t))
  1858.               &body clauses)
  1859.   (declare (arglist (display &key timeout peek-p discard-p force-output-p)
  1860.             (event-or-events ((&rest args) |...|) &body body) |...|))
  1861.   ;; If force-output-p is true, first invokes display-force-output.  Executes
  1862.   ;; the matching clause for each queued event until a clause returns non-nil,
  1863.   ;; and that returned object is then returned by event-case.  If peek-p is
  1864.   ;; true, then the event is not removed from the queue.  If discard-p is
  1865.   ;; true, then events for which the clause returns nil are removed from the
  1866.   ;; queue, otherwise they are left in place.  Hangs until non-nil is
  1867.   ;; generated for some event, or for the specified timeout (in seconds, if
  1868.   ;; given); however, it is acceptable for an implementation to wait only once
  1869.   ;; on network data, and therefore timeout prematurely.  Returns nil on
  1870.   ;; timeout or EOF with a second return value being :timeout for a timeout
  1871.   ;; and some other non-nil value for EOF.  In each clause, event-or-events is
  1872.   ;; an event-key or a list of event-keys (but they need not be typed as
  1873.   ;; keywords) or the symbol t or otherwise (but only in the last clause).
  1874.   ;; The keys are not evaluated, and it is an error for the same key to appear
  1875.   ;; in more than one clause.  Args is the list of event components of
  1876.   ;; interest; corresponding values (if any) are bound to variables with these
  1877.   ;; names (i.e., the args are variable names, not keywords, the keywords are
  1878.   ;; derived from the variable names).  An arg can also be a (keyword var)
  1879.   ;; form, as for keyword args in a lambda lists.  If no t/otherwise clause
  1880.   ;; appears, it is equivalent to having one that returns nil.  If
  1881.   ;; process-event is invoked recursively, the nested invocation begins with
  1882.   ;; the event after the one currently being processed.
  1883.   )
  1884.  
  1885. (defmacro event-cond ((display &key timeout peek-p discard-p (force-output-p t))
  1886.               &body clauses)
  1887.   ;; The clauses of event-cond are of the form:
  1888.   ;; (event-or-events binding-list test-form . body-forms)
  1889.   ;;
  1890.   ;; EVENT-OR-EVENTS    event-key or a list of event-keys (but they
  1891.   ;;            need not be typed as keywords) or the symbol t
  1892.   ;;            or otherwise (but only in the last clause).  If
  1893.   ;;            no t/otherwise clause appears, it is equivalent
  1894.   ;;            to having one that returns nil.  The keys are
  1895.   ;;            not evaluated, and it is an error for the same
  1896.   ;;            key to appear in more than one clause.
  1897.   ;;
  1898.   ;; BINDING-LIST    The list of event components of interest.
  1899.   ;;            corresponding values (if any) are bound to
  1900.   ;;            variables with these names (i.e., the binding-list
  1901.   ;;            has variable names, not keywords, the keywords are
  1902.   ;;            derived from the variable names).  An arg can also
  1903.   ;;            be a (keyword var) form, as for keyword args in a
  1904.   ;;            lambda list.
  1905.   ;;
  1906.   ;; The matching TEST-FORM for each queued event is executed until a
  1907.   ;; clause's test-form returns non-nil.  Then the BODY-FORMS are
  1908.   ;; evaluated, returning the (possibly multiple) values of the last
  1909.   ;; form from event-cond.  If there are no body-forms then, if the
  1910.   ;; test-form is non-nil, the value of the test-form is returned as a
  1911.   ;; single value.
  1912.   ;;
  1913.   ;; Options:
  1914.   ;; FORCE-OUTPUT-P    When true, first invoke display-force-output if no
  1915.   ;;              input is pending.
  1916.   ;;
  1917.   ;; PEEK-P        When true, then the event is not removed from the queue.
  1918.   ;;
  1919.   ;; DISCARD-P        When true, then events for which the clause returns nil
  1920.   ;;             are removed from the queue, otherwise they are left in place.
  1921.   ;;
  1922.   ;; TIMEOUT        If NIL, hang until non-nil is generated for some event's
  1923.   ;;            test-form. Otherwise return NIL after TIMEOUT seconds have
  1924.   ;;            elapsed.  NIL is also returned whenever EOF is read.
  1925.   ;;            Whenever NIL is returned a second value is returned which
  1926.   ;;            is either :TIMEOUT if a timeout occurred or some other
  1927.   ;;            non-NIL value if an EOF is detected.
  1928.   ;;
  1929.   (declare (arglist (display &key timeout peek-p discard-p force-output-p)
  1930.            (event-or-events (&rest args) test-form &body body) |...|))
  1931.   )
  1932.  
  1933. (defun discard-current-event (display)
  1934.   (declare (type display display)
  1935.        (values boolean))
  1936.   ;; Discard the current event for DISPLAY.
  1937.   ;; Returns NIL when the event queue is empty, else T.
  1938.   ;; To ensure events aren't ignored, application code should only call
  1939.   ;; this when throwing out of event-case or process-next-event, or from
  1940.   ;; inside even-case, event-cond or process-event when :peek-p is T and
  1941.   ;; :discard-p is NIL.
  1942.  )
  1943.  
  1944. (defmacro declare-event (event-codes &rest declares)
  1945.   ;; Used to indicate the keyword arguments for handler functions in process-event
  1946.   ;; and event-case.  In the declares, an argument listed as (name1 name2) indicates
  1947.   ;; synonyms for the same argument.  All process-event handlers can have
  1948.   ;; (display display), (event-key event-key), and (boolean send-event-p) as keyword
  1949.   ;; arguments, and an event-case clause can also have event-key and send-event-p as
  1950.   ;; arguments.
  1951.   (declare (arglist event-key-or-keys &rest (type &rest keywords))))
  1952.  
  1953. (declare-event (:key-press :key-release :button-press :button-release)
  1954.   (card16 sequence)
  1955.   (window (window event-window) root)
  1956.   ((or null window) child)
  1957.   (boolean same-screen-p)
  1958.   (int16 x y root-x root-y)
  1959.   (card16 state)
  1960.   ((or null card32) time)
  1961.   ;; for key-press and key-release, code is the keycode
  1962.   ;; for button-press and button-release, code is the button number
  1963.   (card8 code))
  1964.  
  1965. (declare-event :motion-notify
  1966.   (card16 sequence)
  1967.   (window (window event-window) root)
  1968.   ((or null window) child)
  1969.   (boolean same-screen-p)
  1970.   (int16 x y root-x root-y)
  1971.   (card16 state)
  1972.   ((or null card32) time)
  1973.   (boolean hint-p))
  1974.  
  1975. (declare-event (:enter-notify :leave-notify)
  1976.   (card16 sequence)
  1977.   (window (window event-window) root)
  1978.   ((or null window) child)
  1979.   (boolean same-screen-p)
  1980.   (int16 x y root-x root-y)
  1981.   (card16 state)
  1982.   ((or null card32) time)
  1983.   ((member :normal :grab :ungrab) mode)
  1984.   ((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual) kind)
  1985.   (boolean focus-p))
  1986.  
  1987. (declare-event (:focus-in :focus-out)
  1988.   (card16 sequence)
  1989.   (window (window event-window))
  1990.   ((member :normal :while-grabbed :grab :ungrab) mode)
  1991.   ((member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual
  1992.        :pointer :pointer-root :none)
  1993.    kind))
  1994.  
  1995. (declare-event :keymap-notify
  1996.   ((bit-vector 256) keymap))
  1997.  
  1998. (declare-event :exposure
  1999.   (card16 sequence)
  2000.   (window (window event-window))
  2001.   (card16 x y width height count))
  2002.  
  2003. (declare-event :graphics-exposure
  2004.   (card16 sequence)
  2005.   (drawable (drawable event-window))
  2006.   (card16 x y width height count)
  2007.   (card8 major)
  2008.   (card16 minor))
  2009.  
  2010. (declare-event :no-exposure
  2011.   (card16 sequence)
  2012.   (drawable (drawable event-window))
  2013.   (card8 major)
  2014.   (card16 minor))
  2015.  
  2016. (declare-event :visibility-notify
  2017.   (card16 sequence)
  2018.   (window (window event-window))
  2019.   ((member :unobscured :partially-obscured :fully-obscured) state))
  2020.  
  2021. (declare-event :create-notify
  2022.   (card16 sequence)
  2023.   (window window (parent event-window))
  2024.   (int16 x y)
  2025.   (card16 width height border-width)
  2026.   (boolean override-redirect-p))
  2027.  
  2028. (declare-event :destroy-notify
  2029.   (card16 sequence)
  2030.   (window event-window window))
  2031.  
  2032. (declare-event :unmap-notify
  2033.   (card16 sequence)
  2034.   (window event-window window)
  2035.   (boolean configure-p))
  2036.  
  2037. (declare-event :map-notify
  2038.   (card16 sequence)
  2039.   (window event-window window)
  2040.   (boolean override-redirect-p))
  2041.  
  2042. (declare-event :map-request
  2043.   (card16 sequence)
  2044.   (window (parent event-window) window))
  2045.  
  2046. (declare-event :reparent-notify
  2047.   (card16 sequence)
  2048.   (window event-window window parent)
  2049.   (int16 x y)
  2050.   (boolean override-redirect-p))
  2051.  
  2052. (declare-event :configure-notify
  2053.   (card16 sequence)
  2054.   (window event-window window)
  2055.   (int16 x y)
  2056.   (card16 width height border-width)
  2057.   ((or null window) above-sibling)
  2058.   (boolean override-redirect-p))
  2059.  
  2060. (declare-event :gravity-notify
  2061.   (card16 sequence)
  2062.   (window event-window window)
  2063.   (int16 x y))
  2064.  
  2065. (declare-event :resize-request
  2066.   (card16 sequence)
  2067.   (window (window event-window))
  2068.   (card16 width height))
  2069.  
  2070. (declare-event :configure-request
  2071.   (card16 sequence)
  2072.   (window (parent event-window) window)
  2073.   (int16 x y)
  2074.   (card16 width height border-width)
  2075.   ((member :above :below :top-if :bottom-if :opposite) stack-mode)
  2076.   ((or null window) above-sibling)
  2077.   (mask16 value-mask))
  2078.  
  2079. (declare-event :circulate-notify
  2080.   (card16 sequence)
  2081.   (window event-window window)
  2082.   ((member :top :bottom) place))
  2083.  
  2084. (declare-event :circulate-request
  2085.   (card16 sequence)
  2086.   (window (parent event-window) window)
  2087.   ((member :top :bottom) place))
  2088.  
  2089. (declare-event :property-notify
  2090.   (card16 sequence)
  2091.   (window (window event-window))
  2092.   (keyword atom)
  2093.   ((member :new-value :deleted) state)
  2094.   ((or null card32) time))
  2095.  
  2096. (declare-event :selection-clear
  2097.   (card16 sequence)
  2098.   (window (window event-window))
  2099.   (keyword selection)
  2100.   ((or null card32) time))
  2101.  
  2102. (declare-event :selection-request
  2103.   (card16 sequence)
  2104.   (window (window event-window) requestor)
  2105.   (keyword selection target)
  2106.   ((or null keyword) property)
  2107.   ((or null card32) time))
  2108.  
  2109. (declare-event :selection-notify
  2110.   (card16 sequence)
  2111.   (window (window event-window))
  2112.   (keyword selection target)
  2113.   ((or null keyword) property)
  2114.   ((or null card32) time))
  2115.  
  2116. (declare-event :colormap-notify
  2117.   (card16 sequence)
  2118.   (window (window event-window))
  2119.   ((or null colormap) colormap)
  2120.   (boolean new-p installed-p))
  2121.  
  2122. (declare-event :mapping-notify
  2123.   (card16 sequence)
  2124.   ((member :modifier :keyboard :pointer) request)
  2125.   (card8 start count))
  2126.  
  2127. (declare-event :client-message
  2128.   (card16 sequence)
  2129.   (window (window event-window))
  2130.   ((member 8 16 32) format)
  2131.   ((sequence integer) data))
  2132.  
  2133. (defun queue-event (display event-key &rest args &key append-p &allow-other-keys)
  2134.   ;; The event is put at the head of the queue if append-p is nil, else the tail.
  2135.   ;; Additional arguments depend on event-key, and are as specified above with
  2136.   ;; declare-event, except that both resource-ids and resource objects are accepted
  2137.   ;; in the event components.
  2138.   (declare (type display display)
  2139.        (type event-key event-key)
  2140.        (type boolean append-p)))
  2141.  
  2142.  
  2143.  
  2144. ;;; From here on, there has been less coherent review of the interface:
  2145.  
  2146. ;;;-----------------------------------------------------------------------------
  2147. ;;; Window Manager Property functions
  2148.  
  2149. (defun wm-name (window)
  2150.   (declare (type window window)
  2151.        (values string)))
  2152.  
  2153. (defsetf wm-name (window) (name))
  2154.  
  2155. (defun wm-icon-name (window)
  2156.   (declare (type window window)
  2157.        (values string)))
  2158.  
  2159. (defsetf wm-icon-name (window) (name))
  2160.  
  2161. (defun get-wm-class (window)
  2162.   (declare (type window window)
  2163.        (values (or null name-string) (or null class-string))))
  2164.  
  2165. (defun set-wm-class (window resource-name resource-class)
  2166.   (declare (type window window)
  2167.        (type (or null stringable) resource-name resource-class)))
  2168.  
  2169. (defun wm-command (window)
  2170.   ;; Returns a list whose car is a command string and 
  2171.   ;; whose cdr is the list of argument strings.
  2172.   (declare (type window window)
  2173.        (values (list string))))
  2174.  
  2175. (defsetf wm-command (window) (command)
  2176.   ;; Uses PRIN1 inside the ANSI common lisp form WITH-STANDARD-IO-SYNTAX (or
  2177.   ;; equivalent), with elements of command separated by NULL characters.  This
  2178.   ;; enables 
  2179.   ;;   (with-standard-io-syntax (mapcar #'read-from-string (wm-command window)))
  2180.   ;; to recover a lisp command.
  2181.   (declare (type window window)
  2182.        (type (list stringable) command)))
  2183.  
  2184. (defun wm-client-machine (window)
  2185.   ;; Returns a list whose car is a command string and 
  2186.   ;; whose cdr is the list of argument strings.
  2187.   (declare (type window window)
  2188.        (values string)))
  2189.  
  2190. (defsetf wm-client-machine (window) (string)
  2191.   (declare (type window window)
  2192.        (type stringable string)))
  2193.  
  2194. (defstruct wm-hints
  2195.   (input nil :type (or null (member :off :on)))
  2196.   (initial-state nil :type (or null (member :normal :iconic)))
  2197.   (icon-pixmap nil :type (or null pixmap))
  2198.   (icon-window nil :type (or null window))
  2199.   (icon-x nil :type (or null card16))
  2200.   (icon-y nil :type (or null card16))
  2201.   (icon-mask nil :type (or null pixmap))
  2202.   (window-group nil :type (or null resource-id))
  2203.   (flags 0 :type card32)    ;; Extension-hook.  Exclusive-Or'ed with the FLAGS field
  2204.   ;; may be extended in the future
  2205.   )
  2206.  
  2207. (defun wm-hints (window)
  2208.   (declare (type window window)
  2209.        (values wm-hints)))
  2210.  
  2211. (defsetf wm-hints (window) (wm-hints))
  2212.  
  2213.  
  2214. (defstruct wm-size-hints
  2215.   ;; Defaulted T to put the burden of remembering these on widget programmers.
  2216.   (user-specified-position-p t :type boolean) ;; True when user specified x y
  2217.   (user-specified-size-p t :type boolean)     ;; True when user specified width height
  2218.   (x nil :type (or null int16))              ;; Obsolete
  2219.   (y nil :type (or null int16))              ;; Obsolete
  2220.   (width nil :type (or null card16))          ;; Obsolete
  2221.   (height nil :type (or null card16))          ;; Obsolete
  2222.   (min-width nil :type (or null card16))
  2223.   (min-height nil :type (or null card16))
  2224.   (max-width nil :type (or null card16))
  2225.   (max-height nil :type (or null card16))
  2226.   (width-inc nil :type (or null card16))
  2227.   (height-inc nil :type (or null card16))
  2228.   (min-aspect nil :type (or null number))
  2229.   (max-aspect nil :type (or null number))
  2230.   (base-width nil :type (or null card16))
  2231.   (base-height nil :type (or null card16))
  2232.   (win-gravity nil :type (or null win-gravity)))
  2233.  
  2234. (defun wm-normal-hints (window)
  2235.   (declare (type window window)
  2236.        (values wm-size-hints)))
  2237.  
  2238. (defsetf wm-normal-hints (window) (wm-size-hints))
  2239.  
  2240. ;; ICON-SIZES uses the SIZE-HINTS structure
  2241.  
  2242. (defun icon-sizes (window)
  2243.   (declare (type window window)
  2244.        (values wm-size-hints)))
  2245.   
  2246. (defsetf icon-sizes (window) (wm-size-hints))
  2247.  
  2248. (defun wm-protocols (window)
  2249.   (declare (type window window)
  2250.        (values protocols)))
  2251.   
  2252. (defsetf wm-protocols (window) (protocols)
  2253.   (declare (type window window)
  2254.        (type (list keyword) protocols)))
  2255.  
  2256. (defun wm-colormap-windows (window)
  2257.   (declare (type window window)
  2258.        (values windows)))
  2259.   
  2260. (defsetf wm-colormap-windows (window) (windows)
  2261.   (declare (type window window)
  2262.        (type (list window) windows)))
  2263.  
  2264. (defun transient-for (window)
  2265.   (declare (type window window)
  2266.        (values window)))
  2267.  
  2268. (defsetf transient-for (window) (transient)
  2269.   (declare (type window window transient)))
  2270.  
  2271. (defun set-wm-properties (window &rest options &key 
  2272.               name icon-name resource-name resource-class command
  2273.               hints normal-hints
  2274.               ;; the following are used for wm-normal-hints
  2275.               user-specified-position-p user-specified-size-p
  2276.               program-specified-position-p program-specified-size-p
  2277.               min-width min-height max-width max-height
  2278.               width-inc height-inc min-aspect max-aspect
  2279.               base-width base-height win-gravity
  2280.               ;; the following are used for wm-hints
  2281.               input initial-state icon-pixmap icon-window
  2282.               icon-x icon-y icon-mask window-group)
  2283.   ;; Set properties for WINDOW.
  2284.   (declare (type window window)
  2285.        (type (or null stringable) name icoin-name resource-name resource-class)
  2286.        (type (or null list) command)
  2287.        (type (or null wm-hints) hints)
  2288.        (type (or null wm-size-hints) normal-hints)
  2289.        (type boolean user-specified-position-p user-specified-size-p)
  2290.        (type boolean program-specified-position-p program-specified-size-p)
  2291.        (type (or null card16) min-width min-height max-width max-height width-inc height-inc base-width base-height win-gravity)
  2292.        (type (or null number) min-aspect max-aspect)
  2293.        (type (or null (member :off :on)) input)
  2294.        (type (or null (member :normal :iconic)) initial-state)
  2295.        (type (or null pixmap) icon-pixmap icon-mask)
  2296.        (type (or null window) icon-window)
  2297.        (type (or null card16) icon-x icon-y)
  2298.        (type (or null resource-id) window-group)))
  2299.  
  2300. (defun iconify-window (window)
  2301.   (declare (type window window)))
  2302.  
  2303. (defun withdraw-window (window)
  2304.   (declare (type window window)))
  2305.  
  2306. (defstruct standard-colormap
  2307.   (colormap nil :type (or null colormap))
  2308.   (base-pixel 0 :type pixel)
  2309.   (max-color nil :type (or null color))
  2310.   (mult-color nil :type (or null color))
  2311.   (visual nil :type (or null visual-info))
  2312.   (kill nil :type (or (member nil :release-by-freeing-colormap)
  2313.               drawable gcontext cursor colormap font)))
  2314.  
  2315. (defun rgb-colormaps (window property)
  2316.   (declare (type window window)
  2317.        (type (member :rgb_default_map :rgb_best_map :rgb_red_map
  2318.              :rgb_green_map :rgb_blue_map) property)
  2319.        (values (list standard-colormap))))
  2320.  
  2321. (defsetf rgb-colormaps (window property) (standard-colormaps)
  2322.   (declare (type window window)
  2323.        (type (member :rgb_default_map :rgb_best_map :rgb_red_map
  2324.              :rgb_green_map :rgb_blue_map) property)
  2325.        (type (list standard-colormap) standard-colormaps)))
  2326.  
  2327. (defun cut-buffer (display &key (buffer 0) (type :string) (result-type 'string)
  2328.                         (transform #'card8->char) (start 0) end)
  2329.   ;; Return the contents of cut-buffer BUFFER
  2330.   (declare (type display display)
  2331.        (type (integer 0 7) buffer)
  2332.        (type xatom type)
  2333.        (type array-index start)
  2334.        (type (or null array-index) end)
  2335.        (type t result-type)            ;a sequence type
  2336.        (type (or null (function (integer) t)) transform)
  2337.        (values sequence type format bytes-after)))
  2338.  
  2339. (defsetf cut-buffer (display buffer &key (type :string) (format 8)
  2340.                  (transform #'char->card8) (start 0) end) (data))
  2341.  
  2342. (defun rotate-cut-buffers (display &optional (delta 1) (careful-p t))
  2343.   ;; Positive rotates left, negative rotates right (opposite of actual
  2344.   ;; protocol request).  When careful-p, ensure all cut-buffer
  2345.   ;; properties are defined, to prevent errors.
  2346.   (declare (type display display)
  2347.        (type int16 delta)
  2348.        (type boolean careful-p)))
  2349.  
  2350. ;;;-----------------------------------------------------------------------------
  2351. ;;; Keycode mapping
  2352.  
  2353. (defun define-keysym-set (set first-keysym last-keysym)
  2354.   ;; Define all keysyms from first-keysym up to and including
  2355.   ;; last-keysym to be in SET (returned from the keysym-set function).
  2356.   ;; Signals an error if the keysym range overlaps an existing set.
  2357.  (declare (type keyword set)
  2358.       (type keysym first-keysym last-keysym)))
  2359.  
  2360. (defun keysym-set (keysym)
  2361.   ;; Return the character code set name of keysym
  2362.   ;; Note that the keyboard set (255) has been broken up into its parts.
  2363.   (declare (type keysym keysym)
  2364.        (values keyword)))
  2365.  
  2366. (defun define-keysym (object keysym &key lowercase translate modifiers mask display)                  
  2367.   ;; Define the translation from keysym/modifiers to a (usually
  2368.   ;; character) object.  ANy previous keysym definition with
  2369.   ;; KEYSYM and MODIFIERS is deleted before adding the new definition.
  2370.   ;;
  2371.   ;; MODIFIERS is either a modifier-mask or list containing intermixed
  2372.   ;; keysyms and state-mask-keys specifying when to use this
  2373.   ;; keysym-translation.  The default is NIL.
  2374.   ;;
  2375.   ;; MASK is either a modifier-mask or list containing intermixed
  2376.   ;; keysyms and state-mask-keys specifying which modifiers to look at
  2377.   ;; (i.e.  modifiers not specified are don't-cares).
  2378.   ;; If mask is :MODIFIERS then the mask is the same as the modifiers
  2379.   ;; (i.e.  modifiers not specified by modifiers are don't cares)
  2380.   ;; The default mask is *default-keysym-translate-mask*
  2381.   ;;
  2382.   ;; If DISPLAY is specified, the translation will be local to DISPLAY,
  2383.   ;; otherwise it will be the default translation for all displays.
  2384.   ;;
  2385.   ;; LOWERCASE is used for uppercase alphabetic keysyms.  The value
  2386.   ;; is the associated lowercase keysym.  This information is used
  2387.   ;; by the keysym-both-case-p predicate (for caps-lock computations)
  2388.   ;; and by the keysym-downcase function.
  2389.   ;;
  2390.   ;; TRANSLATE will be called with parameters (display state OBJECT)
  2391.   ;; when translating KEYSYM and modifiers and mask are satisfied.
  2392.   ;; [e.g (zerop (logxor (logand state (or mask *default-keysym-translate-mask*))
  2393.   ;;                     (or modifiers 0)))
  2394.   ;;      when mask and modifiers aren't lists of keysyms]
  2395.   ;; The default is #'default-keysym-translate
  2396.   ;;
  2397.   (declare (type (or base-char t) object)
  2398.        (type keysym keysym)
  2399.        (type (or null mask16 list) ;; (list (or keysym state-mask-key))
  2400.              modifiers)
  2401.        (type (or null (member :modifiers) mask16 list) ;; (list (or keysym state-mask-key))
  2402.              mask)
  2403.        (type (or null display) display)
  2404.            (type (or null keysym) lowercase)
  2405.        (type (function (display card16 t) t) translate)))
  2406.  
  2407. (defvar *default-keysym-translate-mask*
  2408.     (the (or (member :modifiers) mask16 list)    ; (list (or keysym state-mask-key))
  2409.          (logand #xff (lognot (make-state-mask :lock))))
  2410.   "Default keysym state mask to use during keysym-translation.")
  2411.  
  2412. (defun undefine-keysym (object keysym &key display modifiers &allow-other-keys)                  
  2413.   ;; Undefine the keysym-translation translating KEYSYM to OBJECT with MODIFIERS.
  2414.   ;; If DISPLAY is non-nil, undefine the translation for DISPLAY if it exists.
  2415.   (declare (type (or base-char t) object)
  2416.        (type keysym keysym)
  2417.        (type (or null mask16 list) ;; (list (or keysym state-mask-key))
  2418.              modifiers)
  2419.        (type (or null display) display)))
  2420.  
  2421. (defun default-keysym-translate (display state object)
  2422.   ;; If object is a character, char-bits are set from state.
  2423.   ;; If object is a list, it is an alist with entries:
  2424.   ;; (base-char [modifiers] [mask-modifiers)
  2425.   ;; When MODIFIERS are specified, this character translation
  2426.   ;; will only take effect when the specified modifiers are pressed.
  2427.   ;; MASK-MODIFIERS can be used to specify a set of modifiers to ignore.
  2428.   ;; When MASK-MODIFIERS is missing, all other modifiers are ignored.
  2429.   ;; In ambiguous cases, the most specific translation is used.
  2430.   (declare (type display display)
  2431.        (type card16 state)
  2432.        (type t object)
  2433.        (values t))) ;; Object returned by keycode->character
  2434.    
  2435. (defmacro keysym (keysym &rest bytes)
  2436.   ;; Build a keysym.
  2437.   ;; If KEYSYM is an integer, it is used as the most significant bits of
  2438.   ;; the keysym, and BYTES are used to specify low order bytes. The last
  2439.   ;; parameter is always byte4 of the keysym.  If KEYSYM is not an
  2440.   ;; integer, the keysym associated with KEYSYM is returned.
  2441.   ;;
  2442.   ;; This is a macro and not a function macro to promote compile-time
  2443.   ;; lookup. All arguments are evaluated.
  2444.   (declare (type t keysym)
  2445.        (type (list card8) bytes)
  2446.        (values keysym)))
  2447.  
  2448. (defun character->keysyms (character &optional display)
  2449.   ;; Given a character, return a list of all matching keysyms.
  2450.   ;; If DISPLAY is given, translations specific to DISPLAY are used,
  2451.   ;; otherwise only global translations are used.
  2452.   ;; Implementation dependent function.
  2453.   ;; May be slow [i.e. do a linear search over all known keysyms]
  2454.   (declare (type t character)
  2455.        (type (or null display) display)
  2456.        (values (list keysym))))
  2457.  
  2458. (defun keycode->keysym (display keycode keysym-index)
  2459.   (declare (type display display)
  2460.        (type card8 code)
  2461.        (type card16 state)
  2462.        (type card8 keysym-index)
  2463.        (values keysym)))
  2464.  
  2465. (defun keysym->keycodes (display keysym)
  2466.   ;; Return keycodes for keysym, as multiple values
  2467.   (declare (type display display)
  2468.        (type keysym keysym)
  2469.        (values (or null keycode) (or null keycode) (or null keycode)))
  2470.   )
  2471.  
  2472. (defun keysym->character (display keysym &optional state)
  2473.   ;; Find the character associated with a keysym.
  2474.   ;; STATE is used for adding char-bits to character as follows:
  2475.   ;;    control -> char-control-bit
  2476.   ;;    mod-1 -> char-meta-bit
  2477.   ;;    mod-2 -> char-super-bit
  2478.   ;;    mod-3 -> char-hyper-bit
  2479.   ;; Implementation dependent function.
  2480.   (declare (type display display)
  2481.        (type keysym keysym)
  2482.        (type (or null card16) state)
  2483.        (values (or null character))))
  2484.  
  2485. (defun keycode->character (display keycode state &key keysym-index
  2486.                        (keysym-index-function #'default-keysym-index))
  2487.   ;; keysym-index defaults to the result of keysym-index-function which
  2488.   ;; is called with the following parameters:
  2489.   ;; (char0 state caps-lock-p keysyms-per-keycode)
  2490.   ;; where char0 is the "character" object associated with keysym-index 0 and
  2491.   ;; caps-lock-p is non-nil when the keysym associated with the lock
  2492.   ;; modifier is for caps-lock.
  2493.   ;; STATE is also used for setting char-bits:
  2494.   ;;    control -> char-control-bit
  2495.   ;;    mod-1 -> char-meta-bit
  2496.   ;;    mod-2 -> char-super-bit
  2497.   ;;    mod-3 -> char-hyper-bit
  2498.   ;; Implementation dependent function.
  2499.   (declare (type display display)
  2500.        (type card8 keycode)
  2501.        (type card16 state)
  2502.        (type (or null card8) keysym-index)
  2503.        (type (or null (function (char0 state caps-lock-p keysyms-per-keycode) card8))
  2504.          keysym-index-function)
  2505.        (values (or null character))))
  2506.  
  2507. (defun default-keysym-index (display keycode state)
  2508.   ;; Returns a keysym-index for use with keycode->character
  2509.   (declare (values card8))
  2510. )
  2511.  
  2512. ;;; default-keysym-index implements the following tables:
  2513. ;;;
  2514. ;;; control shift caps-lock character               character
  2515. ;;;   0       0       0       #\a                      #\8
  2516. ;;;   0       0       1       #\A                      #\8
  2517. ;;;   0       1       0       #\A                      #\*
  2518. ;;;   0       1       1       #\A                      #\*
  2519. ;;;   1       0       0       #\control-A              #\control-8
  2520. ;;;   1       0       1       #\control-A              #\control-8
  2521. ;;;   1       1       0       #\control-shift-a        #\control-*
  2522. ;;;   1       1       1       #\control-shift-a        #\control-*
  2523. ;;;
  2524. ;;; control shift shift-lock character               character
  2525. ;;;   0       0       0       #\a                      #\8
  2526. ;;;   0       0       1       #\A                      #\*
  2527. ;;;   0       1       0       #\A                      #\*
  2528. ;;;   0       1       1       #\A                      #\8
  2529. ;;;   1       0       0       #\control-A              #\control-8
  2530. ;;;   1       0       1       #\control-A              #\control-*
  2531. ;;;   1       1       0       #\control-shift-a        #\control-*
  2532. ;;;   1       1       1       #\control-shift-a        #\control-8
  2533.  
  2534. (defun state-keysymp (display state keysym)
  2535.   ;; Returns T when a modifier key associated with KEYSYM is on in STATE
  2536.   (declare (type display display)
  2537.        (type card16 state)
  2538.        (type keysym keysym)
  2539.        (values boolean)))
  2540.  
  2541. (defun mapping-notify (display request start count)
  2542.   ;; Called on a mapping-notify event to update
  2543.   ;; the keyboard-mapping cache in DISPLAY
  2544.   (declare (type display display)
  2545.        (type (member :modifier :keyboard :pointer) request)
  2546.        (type card8 start count)))
  2547.  
  2548. (defun keysym-in-map-p (display keysym keymap)
  2549.   ;; Returns T if keysym is found in keymap
  2550.   (declare (type display display)
  2551.        (type keysym keysym)
  2552.        (type (bit-vector 256) keymap)
  2553.        (value boolean)))
  2554.  
  2555. (defun character-in-map-p (display character keymap)
  2556.   ;; Implementation dependent function.
  2557.   ;; Returns T if character is found in keymap
  2558.   (declare (type display display)
  2559.        (type t character)
  2560.        (type (bit-vector 256) keymap)
  2561.        (value boolean)))
  2562.  
  2563. ;;;-----------------------------------------------------------------------------
  2564. ;;; Extensions
  2565.  
  2566. (defmacro define-extension (name &key events errors)
  2567.   ;; Define extension NAME with EVENTS and ERRORS.
  2568.   ;; Note: The case of NAME is important.
  2569.   ;; To define the request, Use:
  2570.   ;;     (with-buffer-request (display (extension-opcode ,name)) ,@body)
  2571.   ;;     See the REQUESTS file for lots of examples.
  2572.   ;; To define event handlers, use declare-event.
  2573.   ;; To define error handlers, use declare-error and define-condition.
  2574.   (declare (type stringable name)
  2575.        (type (list symbol) events errors)))
  2576.  
  2577. (defmacro extension-opcode (display name)
  2578.   ;; Returns the major opcode for extension NAME.
  2579.   ;; This is a macro to enable NAME to be interned for fast run-time
  2580.   ;; retrieval. 
  2581.   ;; Note: The case of NAME is important.
  2582.   (declare (type display display)
  2583.        (type stringable name)
  2584.        (values card8)))
  2585.  
  2586. (defmacro define-error (error-key function)
  2587.   ;; Associate a function with ERROR-KEY which will be called with
  2588.   ;; parameters DISPLAY and REPLY-BUFFER and returns a plist of
  2589.   ;; keyword/value pairs which will be passed on to the error handler.
  2590.   ;; A compiler warning is printed when ERROR-KEY is not defined in a
  2591.   ;; preceding DEFINE-EXTENSION.
  2592.   ;; Note: REPLY-BUFFER may used with the READING-EVENT and READ-type
  2593.   ;;       macros for getting error fields. See DECODE-CORE-ERROR for
  2594.   ;        an example.
  2595.   (declare (type symbol error-key)
  2596.        (type function function)))
  2597.  
  2598. ;; All core errors use this, so we make it available to extensions.
  2599. (defun decode-core-error (display event &optional arg)
  2600.   ;; All core errors have the following keyword/argument pairs:
  2601.   ;;    :major integer
  2602.   ;;    :minor integer
  2603.   ;;    :sequence integer
  2604.   ;;    :current-sequence integer
  2605.   ;; In addition, many have an additional argument that comes from the
  2606.   ;; same place in the event, but is named differently.  When the ARG
  2607.   ;; argument is specified, the keyword ARG with card32 value starting
  2608.   ;; at byte 4 of the event is returned with the other keyword/argument
  2609.   ;; pairs.
  2610.   (declare (type display display)
  2611.        (type reply-buffer event)
  2612.        (type (or null keyword) arg)
  2613.        (values keyword/arg-plist)))
  2614.  
  2615. ;; This isn't new, just extended.
  2616. (defmacro declare-event (event-codes &body declares)
  2617.   ;; Used to indicate the keyword arguments for handler functions in
  2618.   ;; process-event and event-case.
  2619.   ;; Generates functions used in SEND-EVENT.
  2620.   ;; A compiler warning is printed when all of EVENT-CODES are not
  2621.   ;; defined by a preceding DEFINE-EXTENSION.
  2622.   ;; See the INPUT file for lots of examples.
  2623.   (declare (type (or keyword (list keywords)) event-codes)
  2624.        (type (alist (field-type symbol) (field-names (list symbol)))
  2625.                  declares)))
  2626.  
  2627. (defmacro define-gcontext-accessor (name &key default set-function copy-function)
  2628.   ;; This will define a new gcontext accessor called NAME.
  2629.   ;; Defines the gcontext-NAME accessor function and its defsetf.
  2630.   ;; Gcontext's will cache DEFAULT-VALUE and the last value SETF'ed when
  2631.   ;; gcontext-cache-p is true.  The NAME keyword will be allowed in
  2632.   ;; CREATE-GCONTEXT, WITH-GCONTEXT, and COPY-GCONTEXT-COMPONENTS.
  2633.   ;; SET-FUNCTION will be called with parameters (GCONTEXT NEW-VALUE)
  2634.   ;; from create-gcontext, and force-gcontext-changes.
  2635.   ;; COPY-FUNCTION will be called with parameters (src-gc dst-gc src-value)
  2636.   ;; from copy-gcontext and copy-gcontext-components.
  2637.   ;; The copy-function defaults to:
  2638.   ;; (lambda (ignore dst-gc value)
  2639.   ;;    (if value
  2640.   ;;        (,set-function dst-gc value)
  2641.   ;;      (error "Can't copy unknown GContext component ~a" ',name)))
  2642.   (declare (type symbol name)
  2643.        (type t default)
  2644.        (type (function (gcontext t) t) set-function) ;; required
  2645.        (type (or null (function (gcontext gcontext t) t))
  2646.          copy-function)))
  2647.  
  2648.  
  2649. ;; To aid extension implementors in attaching additional information to
  2650. ;; clx data structures, the following accessors (with SETF's) are
  2651. ;; defined.  GETF can be used on these to extend the structures.
  2652.  
  2653. display-plist
  2654. screen-plist
  2655. visual-info-plist
  2656. gcontext-plist
  2657. font-plist
  2658. drawable-plist
  2659.  
  2660.  
  2661.  
  2662. ;;; These have had perhaps even less review.
  2663.  
  2664. ;;; Add some of the functionality provided by the C XLIB library.
  2665. ;;;
  2666. ;;; LaMott G. Oren, Texas Instruments  10/87
  2667. ;;; 
  2668. ;;; Design Contributors:
  2669. ;;;    Robert W. Scheifler, MIT
  2670.  
  2671. ;;;-----------------------------------------------------------------------------
  2672. ;;; Regions (not yet implemented)
  2673.  
  2674. ;;; Regions are arbitrary collections of pixels.  This is represented
  2675. ;;; in the region structure as either a list of rectangles or a bitmap.
  2676.  
  2677. (defun make-region (&optional x y width height)
  2678.   ;; With no parameters, returns an empty region
  2679.   ;; If some parameters are given, all must be given.
  2680.   (declare (type (or null int16) x y width height)
  2681.        (values region)))
  2682.  
  2683. (defun region-p (thing))
  2684.  
  2685. (defun copy-region (region))
  2686.  
  2687. (defun region-empty-p (region)
  2688.   (declare (type region region)
  2689.        (values boolean)))
  2690.  
  2691. (defun region-clip-box (region)
  2692.   ;; Returns a region which is the smallest enclosing rectangle
  2693.   ;; enclosing REGION
  2694.   (declare (type region region)
  2695.        (values region)))
  2696.  
  2697. ;; Accessors that return the boundaries of a region
  2698. (defun region-x (region))
  2699. (defun region-y (region))
  2700. (defun region-width (region))
  2701. (defun region-height (region))
  2702.  
  2703. (defsetf region-x (region) (x))
  2704. (defsetf region-y (region) (y))
  2705. ;; Setting a region's X/Y translates the region
  2706.  
  2707. (defun region-intersection (&rest regions)
  2708.   "Returns a region which is the intersection of one or more REGIONS.
  2709. Returns an empty region if the intersection is empty.
  2710. If there are no regions given, return a very large region."
  2711.   (declare (type (list region) regions)
  2712.        (values region)))
  2713.  
  2714. (defun region-union (&rest regions)
  2715.   "Returns a region which is the union of a number of REGIONS
  2716.  (i.e. the smallest region that can contain all the other regions)
  2717.  Returns the empty region if no regions are given."
  2718.   (declare (type (list region) regions)
  2719.        (values region)))
  2720.  
  2721. (defun region-subtract (region subtract)
  2722.   "Returns a region containing the points that are in REGION but not in SUBTRACT"
  2723.   (declare (type region region subtract)
  2724.        (values region)))
  2725.  
  2726. (defun point-in-region-p (region x y)
  2727.   ;; Returns T when X/Y are a point within REGION.
  2728.   (declare (type region region)
  2729.        (type int16 x y)
  2730.        (values boolean)))
  2731.  
  2732. (defun region-equal (a b)
  2733.   ;; Returns T when regions a and b contain the same points.
  2734.   ;; That is, return t when for every X/Y (point-in-region-p a x y)
  2735.   ;; equals (point-in-region-p b x y)
  2736.   (declare (type region a b)
  2737.        (values boolean)))
  2738.  
  2739. (defun subregion-p (large small)
  2740.   "Returns T if SMALL is within LARGE.
  2741.  That is, return T when for every X/Y (point-in-region-p small X Y)
  2742.  implies (point-in-region-p large X Y)."
  2743.   (declare (type region large small)
  2744.        (values boolean)))
  2745.  
  2746. (defun region-intersect-p (a b)
  2747.   "Returns T if A intersects B.
  2748.  That is, return T when there is some point common to regions A and B."
  2749.   (declare (type region a b)
  2750.        (values boolean)))
  2751.  
  2752. (defun map-region (region function &rest args)
  2753.   ;; Calls function with arguments (x y . args) for every point in REGION.
  2754.   (declare (type region region)
  2755.        (type (function x y &rest args) function)))
  2756.  
  2757. ;;   Why isn't it better to augment
  2758. ;;   gcontext-clip-mask to deal with
  2759. ;;       (or null (member :none) pixmap rect-seq region)
  2760. ;;   and force conversions on the caller?
  2761. ;; Good idea.
  2762.  
  2763. ;;(defun gcontext-clip-region (gcontext)
  2764. ;;  ;; If the clip-mask of GCONTEXT is known, return it as a region.
  2765. ;;  (declare (type gcontext gcontext)
  2766. ;;       (values (or null region))))
  2767.  
  2768. ;;(defsetf gcontext-clip-region (gcontext) (region)
  2769. ;;  ;; Set the clip-rectangles or clip-mask for for GCONTEXT to include
  2770. ;;  ;; only the pixels within REGION.
  2771. ;;  (declare (type gcontext gcontext)
  2772. ;;       (type region region)))
  2773.  
  2774. (defun image->region (image)
  2775.   ;; Returns a region containing the 1 bits of a depth-1 image
  2776.   ;; Signals an error if image isn't of depth 1.
  2777.   (declare (type image image)
  2778.        (values region)))
  2779.  
  2780. (defun region->image (region)
  2781.   ;; Returns a depth-1 image containg 1 bits for every pixel in REGION.
  2782.   (declare (type region region)
  2783.        (values image)))
  2784.  
  2785. (defun polygon-region (points &optional (fill-rule :even-odd))
  2786.   (declare (type sequence points) ;(repeat-seq (integer x) (integer y))
  2787.        (type (member :even-odd :winding) fill-rule)
  2788.        (values region)))
  2789.  
  2790. ;;;-----------------------------------------------------------------------------
  2791. ;;; IMAGE functions
  2792.  
  2793.  
  2794. (deftype bitmap () '(array bit (* *)))
  2795. (deftype pixarray () '(array pixel (* *)))
  2796.  
  2797. (defconstant *lisp-byte-lsb-first-p* #+lispm t #-lispm nil
  2798.          "Byte order in pixel arrays")
  2799.  
  2800. (defstruct image
  2801.   ;; Public structure
  2802.   (width 0 :type card16 :read-only t)
  2803.   (height 0 :type card16 :read-only t)
  2804.   (depth 1 :type card8 :read-only t)
  2805.   (plist nil :type list))
  2806.  
  2807. ;; Image-Plist accessors:
  2808. (defun image-name (image))
  2809. (defun image-x-hot (image))
  2810. (defun image-y-hot (image))
  2811. (defun image-red-mask (image))
  2812. (defun image-blue-mask (image))
  2813. (defun image-green-mask (image))
  2814.  
  2815. (defsetf image-name (image) (name))
  2816. (defsetf image-x-hot (image) (x))
  2817. (defsetf image-y-hot (image) (y))
  2818. (defsetf image-red-mask (image) (mask))
  2819. (defsetf image-blue-mask (image) (mask))
  2820. (defsetf image-green-mask (image) (mask))
  2821.  
  2822. (defstruct (image-x (:include image))
  2823.   ;; Use this format for shoveling image data
  2824.   ;; Private structure. Accessors for these NOT exported.
  2825.   (format :z-pixmap :type (member :bitmap :xy-pixmap :z-pixmap))
  2826.   (bytes-per-line 0 :type card16)
  2827.   (scanline-pad 32 :type (member 8 16 32))
  2828.   (bits-per-pixel 0 :type (member 1 4 8 16 24 32))
  2829.   (bit-lsb-first-p nil :type boolean)        ; Bit order
  2830.   (byte-lsb-first-p nil :type boolean)        ; Byte order
  2831.   (data #() :type (array card8 (*))))        ; row-major
  2832.  
  2833. (defstruct (image-xy (:include image))
  2834.   ;; Public structure
  2835.   ;; Use this format for image processing
  2836.   (bitmap-list nil :type (list bitmap)))
  2837.  
  2838. (defstruct (image-z (:include image))
  2839.   ;; Public structure
  2840.   ;; Use this format for image processing
  2841.   (bits-per-pixel 0 :type (member 1 4 8 16 24 32))
  2842.   (pixarray #() :type pixarray))
  2843.  
  2844. (defun create-image (&key (width (required-arg width))
  2845.                   (height (required-arg height))
  2846.              depth data plist name x-hot y-hot
  2847.              red-mask blue-mask green-mask
  2848.              bits-per-pixel format scanline-pad bytes-per-line
  2849.              byte-lsb-first-p bit-lsb-first-p )
  2850.   ;; Returns an image-x image-xy or image-z structure, depending on the
  2851.   ;; type of the :DATA parameter.
  2852.   (declare
  2853.     (type card16 width height)            ; Required
  2854.     (type (or null card8) depth)        ; Defualts to 1
  2855.     (type (or (array card8 (*))            ;Returns image-x
  2856.           (list bitmap)            ;Returns image-xy
  2857.           pixarray) data)            ;Returns image-z
  2858.     (type list plist)
  2859.     (type (or null stringable) name)
  2860.     (type (or null card16) x-hot y-hot)
  2861.     (type (or null pixel) red-mask blue-mask green-mask)
  2862.     (type (or null (member 1 4 8 16 24 32)) bits-per-pixel)
  2863.  
  2864.     ;; The following parameters are ignored for image-xy and image-z:
  2865.     (type (or null (member :bitmap :xy-pixmap :z-pixmap))
  2866.       format)                ; defaults to :z-pixmap
  2867.     (type (or null (member 8 16 32)) scanline-pad)
  2868.     (type (or null card16) bytes-per-line) ;default from width and scanline-pad
  2869.     (type boolean byte-lsb-first-p bit-lsb-first-p)
  2870.     (values image)))
  2871.  
  2872. (defun get-image (drawable &key 
  2873.           (x (required-arg x))
  2874.           (y (required-arg y))
  2875.           (width (required-arg width))
  2876.           (height (required-arg height))
  2877.           plane-mask format result-type)
  2878.   ;; Get an image from the server.
  2879.   ;; Format defaults to :z-pixmap.  Result-Type defaults from Format,
  2880.   ;; image-z for :z-pixmap, and image-xy for :xy-pixmap.
  2881.   ;; Plane-mask defaults to #xFFFFFFFF.
  2882.   ;; Returns an image-x image-xy or image-z structure, depending on the
  2883.   ;; result-type parameter.
  2884.   (declare (type drawable drawable)
  2885.        (type int16 x y) ;; required
  2886.        (type card16 width height) ;; required
  2887.        (type (or null pixel) plane-mask)
  2888.        (type (or null (member :xy-pixmap :z-pixmap)) format)
  2889.        (type (or null (member image-x image-xy image-z)) result-type)
  2890.        (values image)))
  2891.  
  2892. (defun put-image (drawable gcontext image &key
  2893.           (src-x 0) (src-y 0)
  2894.           (x (required-arg x))
  2895.           (y (required-arg y))
  2896.           width height
  2897.           bitmap-p)
  2898.   ;; When BITMAP-P, force format to be :bitmap when depth=1
  2899.   ;; This causes gcontext to supply foreground & background pixels.
  2900.   (declare (type drawable drawable)
  2901.        (type gcontext gcontext)
  2902.        (type image image)
  2903.        (type int16 x y) ;; required
  2904.        (type (or null card16) width height)
  2905.        (type boolean bitmap-p)))
  2906.  
  2907. (defun copy-image (image &key (x 0) (y 0) width height result-type)
  2908.   ;; Copy with optional sub-imaging and format conversion.
  2909.   ;; result-type defaults to (type-of image)
  2910.   (declare (type image image)
  2911.        (type card16 x y)
  2912.        (type (or null card16) width height) ;; Default from image
  2913.        (type (or null (member image-x image-xy image-z)) result-type)
  2914.        (values image)))
  2915.  
  2916. (defun read-bitmap-file (pathname)
  2917.   ;; Creates an image from a C include file in standard X11 format
  2918.   (declare (type (or pathname string stream) pathname)
  2919.        (values image)))
  2920.  
  2921. (defun write-bitmap-file (pathname image &optional name)
  2922.   ;; Writes an image to a C include file in standard X11 format
  2923.   ;; NAME argument used for variable prefixes.  Defaults to "image"
  2924.   (declare (type (or pathname string stream) pathname)
  2925.        (type image image)
  2926.        (type (or null stringable) name)))
  2927.  
  2928. ;;;-----------------------------------------------------------------------------
  2929. ;;; Resource data-base
  2930.  
  2931.  
  2932. (defun make-resource-database ()
  2933.   ;; Returns an empty resource data-base
  2934.   (declare (values resource-database)))
  2935.  
  2936. (defun get-resource (database value-name value-class full-name full-class)
  2937.   ;; Return the value of the resource in DATABASE whose partial name
  2938.   ;; most closely matches (append full-name (list value-name)) and
  2939.   ;;                      (append full-class (list value-class)).
  2940.   (declare (type resource-database database)
  2941.        (type stringable value-name value-class)
  2942.        (type (list stringable) full-name full-class)
  2943.        (values value)))
  2944.  
  2945. (defun add-resource (database name-list value)
  2946.   ;; name-list is a list of either strings or symbols. If a symbol, 
  2947.   ;; case-insensitive comparisons will be used, if a string,
  2948.   ;; case-sensitive comparisons will be used.  The symbol '* or
  2949.   ;; string "*" are used as wildcards, matching anything or nothing.
  2950.   (declare (type resource-database database)
  2951.        (type (list stringable) name-list)
  2952.        (type t value)))
  2953.  
  2954. (defun delete-resource (database name-list)
  2955.   (declare (type resource-database database)
  2956.        (type (list stringable) name-list)))
  2957.  
  2958. (defun map-resource (database function &rest args)
  2959.   ;; Call FUNCTION on each resource in DATABASE.
  2960.   ;; FUNCTION is called with arguments (name-list value . args)
  2961.   (declare (type resource-database database)
  2962.        (type (function ((list stringable) t &rest t) t) function)
  2963.        (values nil)))
  2964.  
  2965. (defun merge-resources (database with-database)
  2966.   (declare (type resource-database database with-database)
  2967.        (values resource-database))
  2968.   (map-resource #'add-resource database with-database)
  2969.   with-database)
  2970.  
  2971. ;; Note: with-input-from-string can be used with read-resources to define
  2972. ;;       default resources in a program file.
  2973.  
  2974. (defun read-resources (database pathname &key key test test-not)
  2975.   ;; Merges resources from a file in standard X11 format with DATABASE.
  2976.   ;; KEY is a function used for converting value-strings, the default is
  2977.   ;; identity.  TEST and TEST-NOT are predicates used for filtering
  2978.   ;; which resources to include in the database.  They are called with
  2979.   ;; the name and results of the KEY function.
  2980.   (declare (type resource-database database)
  2981.        (type (or pathname string stream) pathname)
  2982.        (type (or null (function (string) t)) key)
  2983.        (type (or null (function ((list string) t) boolean))
  2984.                  test test-not)
  2985.        (values resource-database)))
  2986.  
  2987. (defun write-resources (database pathname &key write test test-not)
  2988.   ;; Write resources to PATHNAME in the standard X11 format.
  2989.   ;; WRITE is a function used for writing values, the default is #'princ
  2990.   ;; TEST and TEST-NOT are predicates used for filtering which resources
  2991.   ;; to include in the database.  They are called with the name and value.
  2992.   (declare (type resource-database database)
  2993.        (type (or pathname string stream) pathname)
  2994.        (type (or null (function (string stream) t)) write)
  2995.        (type (or null (function ((list string) t) boolean))
  2996.                  test test-not)))
  2997.  
  2998. (defun root-resources (screen &key database key test test-not)
  2999.   "Returns a resource database containing the contents of the root window
  3000.    RESOURCE_MANAGER property for the given SCREEN. If SCREEN is a display,
  3001.    then its default screen is used. If an existing DATABASE is given, then
  3002.    resource values are merged with the DATABASE and the modified DATABASE is
  3003.    returned.
  3004.  
  3005.    TEST and TEST-NOT are predicates for selecting which resources are
  3006.    read.  Arguments are a resource name list and a resource value. The KEY
  3007.    function, if given, is called to convert a resource value string to the
  3008.    value given to TEST or TEST-NOT."
  3009.  
  3010.   (declare (type (or screen display) screen)
  3011.        (type (or null resource-database) database)
  3012.        (type (or null (function (string) t)) key)
  3013.        (type (or null (function (list t) boolean)) test test-not)
  3014.        (values resource-database)))
  3015.  
  3016. (defsetf root-resources (screen &key test test-not (write 'princ)) (database)
  3017.   "Changes the contents of the root window RESOURCE_MANAGER property for the
  3018.    given SCREEN. If SCREEN is a display, then its default screen is used. 
  3019.  
  3020.    TEST and TEST-NOT are predicates for selecting which resources from the
  3021.    DATABASE are written.  Arguments are a resource name list and a resource
  3022.    value.  The WRITE function is used to convert a resource value into a
  3023.    string stored in the property."
  3024.  
  3025.   (declare (type (or screen display) screen)
  3026.     (type (or null resource-database) database)
  3027.     (type (or null (function (list t) boolean)) test test-not)
  3028.     (type (or null (function (string stream) t)) write)
  3029.     (values resource-database)))
  3030.  
  3031. ;;;-----------------------------------------------------------------------------
  3032. ;;; Shared GContext's
  3033.  
  3034. (defmacro using-gcontext ((var &rest options &key drawable
  3035.                    function plane-mask foreground background
  3036.                    line-width line-style cap-style
  3037.                    join-style fill-style fill-rule arc-mode
  3038.                    tile stipple ts-x ts-y font
  3039.                    subwindow-mode exposures clip-x clip-y
  3040.                    clip-mask clip-ordering dash-offset
  3041.                    dashes)
  3042.               &body body)
  3043.   ;; Equivalent to (let ((var (apply #'make-gcontext options))) ,@body)
  3044.   ;; but more efficient because it uses a gcontext cache associated with
  3045.   ;; drawable's display.
  3046.   )
  3047.  
  3048.  
  3049.  
  3050.  X11 Request Name       CLX Function Name
  3051. -----------------       -----------------
  3052. AllocColor              ALLOC-COLOR
  3053. AllocColorCells         ALLOC-COLOR-CELLS
  3054. AllocColorPlanes        ALLOC-COLOR-PLANES
  3055. AllocNamedColor         ALLOC-COLOR
  3056. AllowEvents             ALLOW-EVENTS
  3057. Bell                    BELL
  3058. ChangeAccessControl     (setf (ACCESS-CONTROL display) boolean)
  3059. ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
  3060. ChangeCloseDownMode     (setf (CLOSE-DOWN-MODE display) mode)
  3061. ChangeGC                FORCE-GCONTEXT-CHANGES
  3062.      ;; See WITH-GCONTEXT
  3063.      (setf (gcontext-function gc) boole-constant)
  3064.      (setf (gcontext-plane-mask gc) card32)
  3065.      (setf (gcontext-foreground gc) card32)
  3066.      (setf (gcontext-background gc) card32)
  3067.      (setf (gcontext-line-width gc) card16)
  3068.      (setf (gcontext-line-style gc) keyword)
  3069.      (setf (gcontext-cap-style gc) keyword)
  3070.      (setf (gcontext-join-style gc) keyword)
  3071.      (setf (gcontext-fill-style gc) keyword)
  3072.      (setf (gcontext-fill-rule gc) keyword)
  3073.      (setf (gcontext-tile gc) pixmap)
  3074.      (setf (gcontext-stipple gc) pixmap)
  3075.      (setf (gcontext-ts-x gc) int16) ;; Tile-Stipple-X-origin
  3076.      (setf (gcontext-ts-y gc) int16) ;; Tile-Stipple-Y-origin
  3077.      (setf (gcontext-font gc &optional metrics-p) font)
  3078.      (setf (gcontext-subwindow-mode gc) keyword)
  3079.      (setf (gcontext-exposures gc) (member :on :off))
  3080.      (setf (gcontext-clip-x gc) int16)
  3081.      (setf (gcontext-clip-y gc) int16)
  3082.      (setf (gcontext-clip-mask gc &optional ordering)
  3083.        (or (member :none) pixmap rect-seq))
  3084.      (setf (gcontext-dash-offset gc) card16)
  3085.      (setf (gcontext-dashes gc) (or card8 sequence))
  3086.      (setf (gcontext-arc-mode gc) (member :chord :pie-slice))
  3087.      (setf (gcontext-clip-ordering gc) keyword)
  3088.  
  3089. ChangeHosts             ADD-ACCESS-HOST
  3090. ChangeHosts             REMOVE-ACCESS-HOST
  3091. ChangeKeyboardControl   CHANGE-KEYBOARD-CONTROL
  3092. ChangePointerControl    CHANGE-POINTER-CONTROL
  3093. ChangeProperty          CHANGE-PROPERTY
  3094. ChangeSaveSet           REMOVE-FROM-SAVE-SET
  3095. ChangeSaveSet           ADD-TO-SAVE-SET
  3096. ChangeWindowAttributes
  3097.      ;; See WITH-STATE
  3098.      (setf (window-background window) value)
  3099.      (setf (window-border window) value)
  3100.      (setf (window-bit-gravity window) value)
  3101.      (setf (window-gravity window) value)
  3102.      (setf (window-backing-store window) value)
  3103.      (setf (window-backing-planes window) value)
  3104.      (setf (window-backing-pixel window) value)
  3105.      (setf (window-override-redirect window) value)
  3106.      (setf (window-save-under window) value)
  3107.      (setf (window-colormap window) value)
  3108.      (setf (window-cursor window) value)
  3109.      (setf (window-event-mask window) value)
  3110.      (setf (window-do-not-propagate-mask window) value)
  3111.  
  3112. CirculateWindow         CIRCULATE-WINDOW-DOWN
  3113. CirculateWindow         CIRCULATE-WINDOW-UP
  3114. ClearToBackground       CLEAR-AREA
  3115. CloseFont               CLOSE-FONT
  3116. ConfigureWindow
  3117.      ;; See WITH-STATE
  3118.      (setf (drawable-x drawable) integer)
  3119.      (setf (drawable-y drawable) integer)
  3120.      (setf (drawable-width drawable) integer)
  3121.      (setf (drawable-height drawable) integer)
  3122.      (setf (drawable-depth drawable) integer)
  3123.      (setf (drawable-border-width drawable) integer)
  3124.      (setf (window-priority window &optional sibling) integer)
  3125.  
  3126. ConvertSelection        CONVERT-SELECTION
  3127. CopyArea                COPY-AREA
  3128. CopyColormapAndFree     COPY-COLORMAP-AND-FREE
  3129. CopyGC                  COPY-GCONTEXT
  3130. CopyGC                  COPY-GCONTEXT-COMPONENTS
  3131. CopyPlane               COPY-PLANE
  3132. CreateColormap          CREATE-COLORMAP
  3133. CreateCursor            CREATE-CURSOR
  3134. CreateGC                CREATE-GCONTEXT
  3135. CreateGlyphCursor       CREATE-GLYPH-CURSOR
  3136. CreatePixmap            CREATE-PIXMAP
  3137. CreateWindow            CREATE-WINDOW
  3138. DeleteProperty          DELETE-PROPERTY
  3139. DestroySubwindows       DESTROY-SUBWINDOWS
  3140. DestroyWindow           DESTROY-WINDOW
  3141. FillPoly                DRAW-LINES
  3142. ForceScreenSaver        RESET-SCREEN-SAVER
  3143. ForceScreenSaver        ACTIVATE-SCREEN-SAVER
  3144. FreeColormap            FREE-COLORMAP
  3145. FreeColors              FREE-COLORS
  3146. FreeCursor              FREE-CURSOR
  3147. FreeGC                  FREE-GCONTEXT
  3148. FreePixmap              FREE-PIXMAP
  3149. GetAtomName             ATOM-NAME
  3150. GetFontPath             FONT-PATH
  3151. GetGeometry             ;; See WITH-STATE
  3152.                         DRAWABLE-ROOT
  3153.                         DRAWABLE-X
  3154.                         DRAWABLE-Y
  3155.                         DRAWABLE-WIDTH
  3156.                         DRAWABLE-HEIGHT
  3157.                         DRAWABLE-DEPTH
  3158.                         DRAWABLE-BORDER-WIDTH
  3159.  
  3160. GetImage                GET-RAW-IMAGE
  3161. GetInputFocus           INPUT-FOCUS
  3162. GetKeyboardControl      KEYBOARD-CONTROL
  3163. GetKeyboardMapping      KEYBOARD-MAPPING
  3164. GetModifierMapping      MODIFIER-MAPPING
  3165. GetMotionEvents         MOTION-EVENTS
  3166. GetPointerControl       POINTER-CONTROL
  3167. GetPointerMapping       POINTER-MAPPING
  3168. GetProperty             GET-PROPERTY
  3169. GetScreenSaver          SCREEN-SAVER
  3170. GetSelectionOwner       SELECTION-OWNER
  3171. GetWindowAttributes     ;; See WITH-STATE
  3172.                         WINDOW-VISUAL-INFO
  3173.                         WINDOW-CLASS
  3174.                         WINDOW-BIT-GRAVITY
  3175.                         WINDOW-GRAVITY
  3176.                         WINDOW-BACKING-STORE
  3177.                         WINDOW-BACKING-PLANES
  3178.                         WINDOW-BACKING-PIXEL
  3179.                         WINDOW-SAVE-UNDER
  3180.                         WINDOW-OVERRIDE-REDIRECT
  3181.                         WINDOW-EVENT-MASK
  3182.                         WINDOW-DO-NOT-PROPAGATE-MASK
  3183.                         WINDOW-COLORMAP
  3184.                         WINDOW-COLORMAP-INSTALLED-P
  3185.                         WINDOW-ALL-EVENT-MASKS
  3186.                         WINDOW-MAP-STATE
  3187.  
  3188. GrabButton              GRAB-BUTTON
  3189. GrabKey                 GRAB-KEY
  3190. GrabKeyboard            GRAB-KEYBOARD
  3191. GrabPointer             GRAB-POINTER
  3192. GrabServer              GRAB-SERVER
  3193. ImageText16             DRAW-IMAGE-GLYPHS
  3194. ImageText16             DRAW-IMAGE-GLYPH
  3195. ImageText8              DRAW-IMAGE-GLYPHS
  3196. InstallColormap         INSTALL-COLORMAP
  3197. InternAtom              FIND-ATOM
  3198. InternAtom              INTERN-ATOM
  3199. KillClient              KILL-TEMPORARY-CLIENTS
  3200. KillClient              KILL-CLIENT
  3201. ListExtensions          LIST-EXTENSIONS
  3202. ListFonts               LIST-FONT-NAMES
  3203. ListFontsWithInfo       LIST-FONTS
  3204. ListHosts               ACCESS-CONTROL
  3205. ListHosts               ACCESS-HOSTS
  3206. ListInstalledColormaps  INSTALLED-COLORMAPS
  3207. ListProperties          LIST-PROPERTIES
  3208. LookupColor             LOOKUP-COLOR
  3209. MapSubwindows           MAP-SUBWINDOWS
  3210. MapWindow               MAP-WINDOW
  3211. OpenFont                OPEN-FONT
  3212. PolyArc                 DRAW-ARC
  3213. PolyArc                 DRAW-ARCS
  3214. PolyFillArc             DRAW-ARC
  3215. PolyFillArc             DRAW-ARCS
  3216. PolyFillRectangle       DRAW-RECTANGLE
  3217. PolyFillRectangle       DRAW-RECTANGLES
  3218. PolyLine                DRAW-LINE
  3219. PolyLine                DRAW-LINES
  3220. PolyPoint               DRAW-POINT
  3221. PolyPoint               DRAW-POINTS
  3222. PolyRectangle           DRAW-RECTANGLE
  3223. PolyRectangle           DRAW-RECTANGLES
  3224. PolySegment             DRAW-SEGMENTS
  3225. PolyText16              DRAW-GLYPH
  3226. PolyText16              DRAW-GLYPHS
  3227. PolyText8               DRAW-GLYPHS
  3228. PutImage                PUT-RAW-IMAGE
  3229. QueryBestSize           QUERY-BEST-CURSOR
  3230. QueryBestSize           QUERY-BEST-STIPPLE
  3231. QueryBestSize           QUERY-BEST-TILE
  3232. QueryColors             QUERY-COLORS
  3233. QueryExtension          QUERY-EXTENSION
  3234. QueryFont               FONT-NAME
  3235.                         FONT-NAME
  3236.                         FONT-DIRECTION
  3237.                         FONT-MIN-CHAR
  3238.                         FONT-MAX-CHAR
  3239.                         FONT-MIN-BYTE1
  3240.                         FONT-MAX-BYTE1
  3241.                         FONT-MIN-BYTE2
  3242.                         FONT-MAX-BYTE2
  3243.                         FONT-ALL-CHARS-EXIST-P
  3244.                         FONT-DEFAULT-CHAR
  3245.                         FONT-ASCENT
  3246.                         FONT-DESCENT
  3247.                         FONT-PROPERTIES
  3248.                         FONT-PROPERTY
  3249.      
  3250.                         CHAR-LEFT-BEARING
  3251.                         CHAR-RIGHT-BEARING
  3252.                         CHAR-WIDTH
  3253.                         CHAR-ASCENT
  3254.                         CHAR-DESCENT
  3255.                         CHAR-ATTRIBUTES
  3256.      
  3257.                         MIN-CHAR-LEFT-BEARING
  3258.                         MIN-CHAR-RIGHT-BEARING
  3259.                         MIN-CHAR-WIDTH
  3260.                         MIN-CHAR-ASCENT
  3261.                         MIN-CHAR-DESCENT
  3262.                         MIN-CHAR-ATTRIBUTES
  3263.      
  3264.                         MAX-CHAR-LEFT-BEARING
  3265.                         MAX-CHAR-RIGHT-BEARING
  3266.                         MAX-CHAR-WIDTH
  3267.                         MAX-CHAR-ASCENT
  3268.                         MAX-CHAR-DESCENT
  3269.                         MAX-CHAR-ATTRIBUTES
  3270.  
  3271. QueryKeymap             QUERY-KEYMAP
  3272. QueryPointer            GLOBAL-POINTER-POSITION
  3273. QueryPointer            POINTER-POSITION
  3274. QueryPointer            QUERY-POINTER
  3275. QueryTextExtents        TEXT-EXTENTS
  3276. QueryTextExtents        TEXT-WIDTH
  3277. QueryTree               QUERY-TREE
  3278. RecolorCursor           RECOLOR-CURSOR
  3279. ReparentWindow          REPARENT-WINDOW
  3280. RotateProperties        ROTATE-PROPERTIES
  3281. SendEvent               SEND-EVENT
  3282. SetClipRectangles       FORCE-GCONTEXT-CHANGES
  3283.      ;; See WITH-GCONTEXT
  3284.      (setf (gcontext-clip-x gc) int16)
  3285.      (setf (gcontext-clip-y gc) int16)
  3286.      (setf (gcontext-clip-mask gc &optional ordering)
  3287.        (or (member :none) pixmap rect-seq))
  3288.      (setf (gcontext-clip-ordering gc) keyword)
  3289.  
  3290. SetDashes               FORCE-GCONTEXT-CHANGES
  3291.      ;; See WITH-GCONTEXT
  3292.      (setf (gcontext-dash-offset gc) card16)
  3293.      (setf (gcontext-dashes gc) (or card8 sequence))
  3294.  
  3295. SetFontPath
  3296.      (setf (font-path font) paths)
  3297.     Where paths is (type (sequence (or string pathname)))
  3298.  
  3299. SetInputFocus           SET-INPUT-FOCUS
  3300. SetKeyboardMapping      CHANGE-KEYBOARD-MAPPING
  3301. SetModifierMapping      SET-MODIFIER-MAPPING
  3302. SetPointerMapping       SET-POINTER-MAPPING
  3303. SetScreenSaver          SET-SCREEN-SAVER
  3304. SetSelectionOwner       SET-SELECTION-OWNER
  3305. StoreColors             STORE-COLOR
  3306. StoreColors             STORE-COLORS
  3307. StoreNamedColor         STORE-COLOR
  3308. StoreNamedColor         STORE-COLORS
  3309. TranslateCoords         TRANSLATE-COORDINATES
  3310. UngrabButton            UNGRAB-BUTTON
  3311. UngrabKey               UNGRAB-KEY
  3312. UngrabKeyboard          UNGRAB-KEYBOARD
  3313. UngrabPointer           UNGRAB-POINTER
  3314. UngrabServer            UNGRAB-SERVER
  3315. UninstallColormap       UNINSTALL-COLORMAP
  3316. UnmapSubwindows         UNMAP-SUBWINDOWS
  3317. UnmapWindow             UNMAP-WINDOW
  3318. WarpPointer             WARP-POINTER
  3319. WarpPointer             WARP-POINTER-IF-INSIDE
  3320. WarpPointer             WARP-POINTER-RELATIVE
  3321. WarpPointer             WARP-POINTER-RELATIVE-IF-INSIDE
  3322. NoOperation             NO-OPERATION
  3323.  
  3324.  
  3325.  
  3326.  X11 Request Name       CLX Function Name
  3327. -----------------       -----------------
  3328. ListHosts               ACCESS-CONTROL
  3329. ListHosts               ACCESS-HOSTS
  3330. ForceScreenSaver        ACTIVATE-SCREEN-SAVER
  3331. ChangeHosts             ADD-ACCESS-HOST
  3332. ChangeSaveSet           ADD-TO-SAVE-SET
  3333. AllocColor              ALLOC-COLOR
  3334. AllocNamedColor         ALLOC-COLOR
  3335. AllocColorCells         ALLOC-COLOR-CELLS
  3336. AllocColorPlanes        ALLOC-COLOR-PLANES
  3337. AllowEvents             ALLOW-EVENTS
  3338. GetAtomName             ATOM-NAME
  3339. Bell                    BELL
  3340. ChangeActivePointerGrab CHANGE-ACTIVE-POINTER-GRAB
  3341. ChangeKeyboardControl   CHANGE-KEYBOARD-CONTROL
  3342. SetKeyboardMapping      CHANGE-KEYBOARD-MAPPING
  3343. ChangePointerControl    CHANGE-POINTER-CONTROL
  3344. ChangeProperty          CHANGE-PROPERTY
  3345. QueryFont               CHAR-ASCENT
  3346. QueryFont               CHAR-ATTRIBUTES
  3347. QueryFont               CHAR-DESCENT
  3348. QueryFont               CHAR-LEFT-BEARING
  3349. QueryFont               CHAR-RIGHT-BEARING
  3350. QueryFont               CHAR-WIDTH
  3351. CirculateWindow         CIRCULATE-WINDOW-DOWN
  3352. CirculateWindow         CIRCULATE-WINDOW-UP
  3353. ClearToBackground       CLEAR-AREA
  3354. CloseFont               CLOSE-FONT
  3355. ConvertSelection        CONVERT-SELECTION
  3356. CopyArea                COPY-AREA
  3357. CopyColormapAndFree     COPY-COLORMAP-AND-FREE
  3358. CopyGC                  COPY-GCONTEXT
  3359. CopyGC                  COPY-GCONTEXT-COMPONENTS
  3360. CopyPlane               COPY-PLANE
  3361. CreateColormap          CREATE-COLORMAP
  3362. CreateCursor            CREATE-CURSOR
  3363. CreateGC                CREATE-GCONTEXT
  3364. CreateGlyphCursor       CREATE-GLYPH-CURSOR
  3365. CreatePixmap            CREATE-PIXMAP
  3366. CreateWindow            CREATE-WINDOW
  3367. DeleteProperty          DELETE-PROPERTY
  3368. DestroySubwindows       DESTROY-SUBWINDOWS
  3369. DestroyWindow           DESTROY-WINDOW
  3370. PolyArc                 DRAW-ARC
  3371. PolyArc                 DRAW-ARCS
  3372. PolyText16              DRAW-GLYPH
  3373. PolyText16              DRAW-GLYPHS
  3374. PolyText8               DRAW-GLYPHS
  3375. ImageText16             DRAW-IMAGE-GLYPH
  3376. ImageText16             DRAW-IMAGE-GLYPHS
  3377. ImageText8              DRAW-IMAGE-GLYPHS
  3378. PolyLine                DRAW-LINE
  3379. PolyLine                DRAW-LINES
  3380. PolyPoint               DRAW-POINT
  3381. PolyPoint               DRAW-POINTS
  3382. PolyFillRectangle       DRAW-RECTANGLE
  3383. PolyRectangle           DRAW-RECTANGLE
  3384. PolyFillRectangle       DRAW-RECTANGLES
  3385. PolyRectangle           DRAW-RECTANGLES
  3386. PolySegment             DRAW-SEGMENTS
  3387. GetGeometry             DRAWABLE-BORDER-WIDTH
  3388. GetGeometry             DRAWABLE-DEPTH
  3389. GetGeometry             DRAWABLE-HEIGHT
  3390. GetGeometry             DRAWABLE-ROOT
  3391. GetGeometry             DRAWABLE-WIDTH
  3392. GetGeometry             DRAWABLE-X
  3393. GetGeometry             DRAWABLE-Y
  3394. FillPoly                FILL-POLYGON
  3395. InternAtom              FIND-ATOM
  3396. QueryFont               FONT-ALL-CHARS-EXIST-P
  3397. QueryFont               FONT-ASCENT
  3398. QueryFont               FONT-DEFAULT-CHAR
  3399. QueryFont               FONT-DESCENT
  3400. QueryFont               FONT-DIRECTION
  3401. QueryFont               FONT-MAX-BYTE1
  3402. QueryFont               FONT-MAX-BYTE2
  3403. QueryFont               FONT-MAX-CHAR
  3404. QueryFont               FONT-MIN-BYTE1
  3405. QueryFont               FONT-MIN-BYTE2
  3406. QueryFont               FONT-MIN-CHAR
  3407. QueryFont               FONT-NAME
  3408. QueryFont               FONT-NAME
  3409. GetFontPath             FONT-PATH
  3410. QueryFont               FONT-PROPERTIES
  3411. QueryFont               FONT-PROPERTY
  3412. ChangeGC                FORCE-GCONTEXT-CHANGES
  3413. SetClipRectangles       FORCE-GCONTEXT-CHANGES
  3414. SetDashes               FORCE-GCONTEXT-CHANGES
  3415. FreeColormap            FREE-COLORMAP
  3416. FreeColors              FREE-COLORS
  3417. FreeCursor              FREE-CURSOR
  3418. FreeGC                  FREE-GCONTEXT
  3419. FreePixmap              FREE-PIXMAP
  3420. GetProperty             GET-PROPERTY
  3421. GetImage                GET-RAW-IMAGE
  3422. QueryPointer            GLOBAL-POINTER-POSITION
  3423. GrabButton              GRAB-BUTTON
  3424. GrabKey                 GRAB-KEY
  3425. GrabKeyboard            GRAB-KEYBOARD
  3426. GrabPointer             GRAB-POINTER
  3427. GrabServer              GRAB-SERVER
  3428. GrabServer              WITH-SERVER-GRABBED
  3429. GetInputFocus           INPUT-FOCUS
  3430. InstallColormap         INSTALL-COLORMAP
  3431. ListInstalledColormaps  INSTALLED-COLORMAPS
  3432. InternAtom              INTERN-ATOM
  3433. GetKeyboardControl      KEYBOARD-CONTROL
  3434. GetKeyboardMapping      KEYBOARD-MAPPING
  3435. KillClient              KILL-CLIENT
  3436. KillClient              KILL-TEMPORARY-CLIENTS
  3437. ListExtensions          LIST-EXTENSIONS
  3438. ListFonts               LIST-FONT-NAMES
  3439. ListFontsWithInfo       LIST-FONTS
  3440. ListProperties          LIST-PROPERTIES
  3441. LookupColor             LOOKUP-COLOR
  3442. MapSubwindows           MAP-SUBWINDOWS
  3443. MapWindow               MAP-WINDOW
  3444. QueryFont               MAX-CHAR-ASCENT
  3445. QueryFont               MAX-CHAR-ATTRIBUTES
  3446. QueryFont               MAX-CHAR-DESCENT
  3447. QueryFont               MAX-CHAR-LEFT-BEARING
  3448. QueryFont               MAX-CHAR-RIGHT-BEARING
  3449. QueryFont               MAX-CHAR-WIDTH
  3450. QueryFont               MIN-CHAR-ASCENT
  3451. QueryFont               MIN-CHAR-ATTRIBUTES
  3452. QueryFont               MIN-CHAR-DESCENT
  3453. QueryFont               MIN-CHAR-LEFT-BEARING
  3454. QueryFont               MIN-CHAR-RIGHT-BEARING
  3455. QueryFont               MIN-CHAR-WIDTH
  3456. GetModifierMapping      MODIFIER-MAPPING
  3457. GetMotionEvents         MOTION-EVENTS
  3458. NoOperation             NO-OPERATION
  3459. OpenFont                OPEN-FONT
  3460. GetPointerControl       POINTER-CONTROL
  3461. GetPointerMapping       POINTER-MAPPING
  3462. QueryPointer            POINTER-POSITION
  3463. PutImage                PUT-RAW-IMAGE
  3464. QueryBestSize           QUERY-BEST-CURSOR
  3465. QueryBestSize           QUERY-BEST-STIPPLE
  3466. QueryBestSize           QUERY-BEST-TILE
  3467. QueryColors             QUERY-COLORS
  3468. QueryExtension          QUERY-EXTENSION
  3469. QueryKeymap             QUERY-KEYMAP
  3470. QueryPointer            QUERY-POINTER
  3471. QueryTree               QUERY-TREE
  3472. RecolorCursor           RECOLOR-CURSOR
  3473. ChangeHosts             REMOVE-ACCESS-HOST
  3474. ChangeSaveSet           REMOVE-FROM-SAVE-SET
  3475. ReparentWindow          REPARENT-WINDOW
  3476. ForceScreenSaver        RESET-SCREEN-SAVER
  3477. RotateProperties        ROTATE-PROPERTIES
  3478. GetScreenSaver          SCREEN-SAVER
  3479. GetSelectionOwner       SELECTION-OWNER
  3480. SendEvent               SEND-EVENT
  3481. ChangeAccessControl     SET-ACCESS-CONTROL
  3482. ChangeCloseDownMode     SET-CLOSE-DOWN-MODE
  3483. SetInputFocus           SET-INPUT-FOCUS
  3484. SetModifierMapping      SET-MODIFIER-MAPPING
  3485. SetPointerMapping       SET-POINTER-MAPPING
  3486. SetScreenSaver          SET-SCREEN-SAVER
  3487. SetSelectionOwner       SET-SELECTION-OWNER
  3488. StoreColors             STORE-COLOR
  3489. StoreColors             STORE-COLORS
  3490. StoreNamedColor         STORE-COLOR
  3491. StoreNamedColor         STORE-COLORS
  3492. QueryTextExtents        TEXT-EXTENTS
  3493. QueryTextExtents        TEXT-WIDTH
  3494. TranslateCoords         TRANSLATE-COORDINATES
  3495. UngrabButton            UNGRAB-BUTTON
  3496. UngrabKey               UNGRAB-KEY
  3497. UngrabKeyboard          UNGRAB-KEYBOARD
  3498. UngrabPointer           UNGRAB-POINTER
  3499. UngrabServer            UNGRAB-SERVER
  3500. UngrabServer            WITH-SERVER-GRABBED
  3501. UninstallColormap       UNINSTALL-COLORMAP
  3502. UnmapSubwindows         UNMAP-SUBWINDOWS
  3503. UnmapWindow             UNMAP-WINDOW
  3504. WarpPointer             WARP-POINTER
  3505. WarpPointer             WARP-POINTER-IF-INSIDE
  3506. WarpPointer             WARP-POINTER-RELATIVE
  3507. WarpPointer             WARP-POINTER-RELATIVE-IF-INSIDE
  3508. GetWindowAttributes     WINDOW-ALL-EVENT-MASKS
  3509. GetWindowAttributes     WINDOW-BACKING-PIXEL
  3510. GetWindowAttributes     WINDOW-BACKING-PLANES
  3511. GetWindowAttributes     WINDOW-BACKING-STORE
  3512. GetWindowAttributes     WINDOW-BIT-GRAVITY
  3513. GetWindowAttributes     WINDOW-CLASS
  3514. GetWindowAttributes     WINDOW-COLORMAP
  3515. GetWindowAttributes     WINDOW-COLORMAP-INSTALLED-P
  3516. GetWindowAttributes     WINDOW-DO-NOT-PROPAGATE-MASK
  3517. GetWindowAttributes     WINDOW-EVENT-MASK
  3518. GetWindowAttributes     WINDOW-GRAVITY
  3519. GetWindowAttributes     WINDOW-MAP-STATE
  3520. GetWindowAttributes     WINDOW-OVERRIDE-REDIRECT
  3521. GetWindowAttributes     WINDOW-SAVE-UNDER
  3522. GetWindowAttributes     WINDOW-VISUAL-INFO
  3523.  
  3524. ConfigureWindow         (SETF (DRAWABLE-BORDER-WIDTH DRAWABLE) INTEGER)
  3525. ConfigureWindow         (SETF (DRAWABLE-DEPTH DRAWABLE) INTEGER)
  3526. ConfigureWindow         (SETF (DRAWABLE-HEIGHT DRAWABLE) INTEGER)
  3527. ConfigureWindow         (SETF (DRAWABLE-WIDTH DRAWABLE) INTEGER)
  3528. ConfigureWindow         (SETF (DRAWABLE-X DRAWABLE) INTEGER)
  3529. ConfigureWindow         (SETF (DRAWABLE-Y DRAWABLE) INTEGER)
  3530. SetFontPath             (SETF (FONT-PATH FONT) PATHS)
  3531. ChangeGC                (SETF (GCONTEXT-ARC-MODE GC) (MEMBER CHORD PIE-SLICE))
  3532. ChangeGC                (SETF (GCONTEXT-BACKGROUND GC) CARD32)
  3533. ChangeGC                (SETF (GCONTEXT-CAP-STYLE GC) KEYWORD)
  3534. SetClipRectangles       (SETF (GCONTEXT-CLIP-MASK GC &OPTIONAL ORDERING)
  3535.                           (OR (MEMBER NONE) PIXMAP RECT-SEQ))
  3536. SetClipRectangles       (SETF (GCONTEXT-CLIP-ORDERING GC) KEYWORD)
  3537. SetClipRectangles       (SETF (GCONTEXT-CLIP-X GC) INT16)
  3538. SetClipRectangles       (SETF (GCONTEXT-CLIP-Y GC) INT16)
  3539. SetDashes               (SETF (GCONTEXT-DASH-OFFSET GC) CARD16)
  3540. SetDashes               (SETF (GCONTEXT-DASHES GC) (OR CARD8 SEQUENCE))
  3541. ChangeGC                (SETF (GCONTEXT-EXPOSURES GC) (MEMBER ON OFF))
  3542. ChangeGC                (SETF (GCONTEXT-FILL-RULE GC) KEYWORD)
  3543. ChangeGC                (SETF (GCONTEXT-FILL-STYLE GC) KEYWORD)
  3544. ChangeGC                (SETF (GCONTEXT-FONT GC &OPTIONAL METRICS-P) FONT)
  3545. ChangeGC                (SETF (GCONTEXT-FOREGROUND GC) CARD32)
  3546. ChangeGC                (SETF (GCONTEXT-FUNCTION GC) BOOLE-CONSTANT)
  3547. ChangeGC                (SETF (GCONTEXT-JOIN-STYLE GC) KEYWORD)
  3548. ChangeGC                (SETF (GCONTEXT-LINE-STYLE GC) KEYWORD)
  3549. ChangeGC                (SETF (GCONTEXT-LINE-WIDTH GC) CARD16)
  3550. ChangeGC                (SETF (GCONTEXT-PLANE-MASK GC) CARD32)
  3551. ChangeGC                (SETF (GCONTEXT-STIPPLE GC) PIXMAP)
  3552. ChangeGC                (SETF (GCONTEXT-SUBWINDOW-MODE GC) KEYWORD)
  3553. ChangeGC                (SETF (GCONTEXT-TILE GC) PIXMAP)
  3554. ChangeGC                (SETF (GCONTEXT-TS-X GC) INT16)
  3555. ChangeGC                (SETF (GCONTEXT-TS-Y GC) INT16)
  3556. ChangeWindowAttributes  (SETF (WINDOW-BACKGROUND WINDOW) VALUE)
  3557. ChangeWindowAttributes  (SETF (WINDOW-BACKING-PIXEL WINDOW) VALUE)
  3558. ChangeWindowAttributes  (SETF (WINDOW-BACKING-PLANES WINDOW) VALUE)
  3559. ChangeWindowAttributes  (SETF (WINDOW-BACKING-STORE WINDOW) VALUE)
  3560. ChangeWindowAttributes  (SETF (WINDOW-BIT-GRAVITY WINDOW) VALUE)
  3561. ChangeWindowAttributes  (SETF (WINDOW-BORDER WINDOW) VALUE)
  3562. ChangeWindowAttributes  (SETF (WINDOW-COLORMAP WINDOW) VALUE)
  3563. ChangeWindowAttributes  (SETF (WINDOW-CURSOR WINDOW) VALUE)
  3564. ChangeWindowAttributes  (SETF (WINDOW-DO-NOT-PROPAGATE-MASK WINDOW) VALUE)
  3565. ChangeWindowAttributes  (SETF (WINDOW-EVENT-MASK WINDOW) VALUE)
  3566. ChangeWindowAttributes  (SETF (WINDOW-GRAVITY WINDOW) VALUE)
  3567. ChangeWindowAttributes  (SETF (WINDOW-OVERRIDE-REDIRECT WINDOW) VALUE)
  3568. ConfigureWindow         (SETF (WINDOW-PRIORITY WINDOW &OPTIONAL SIBLING) INTEGER)
  3569. ChangeWindowAttributes  (SETF (WINDOW-SAVE-UNDER WINDOW) VALUE)
  3570.  
  3571.  
  3572.  
  3573. ;; Here's a list of the CLX functions that don't directly correspond to 
  3574. ;; X Window System requests.  The've been categorized by function:
  3575.  
  3576.                        ;Display Management
  3577. CLOSE-DISPLAY
  3578. CLOSE-DOWN-MODE
  3579. DISPLAY-AFTER-FUNCTION ;; SETF'able
  3580. DISPLAY-FINISH-OUTPUT
  3581. DISPLAY-FORCE-OUTPUT
  3582. DISPLAY-INVOKE-AFTER-FUNCTION
  3583. OPEN-DISPLAY
  3584. WITH-DISPLAY
  3585. WITH-EVENT-QUEUE
  3586.                        ;Extensions
  3587. DECLARE-EVENT
  3588. DECODE-CORE-ERROR
  3589. DEFAULT-ERROR-HANDLER
  3590. DEFINE-CONDITION
  3591. DEFINE-ERROR
  3592. DEFINE-EXTENSION
  3593. DEFINE-GCONTEXT-ACCESSOR
  3594. EXTENSION-OPCODE
  3595.                        ;Events
  3596. EVENT-CASE
  3597. EVENT-LISTEN
  3598. MAPPING-NOTIFY
  3599. PROCESS-EVENT
  3600. EVENT-HANDLER
  3601. MAKE-EVENT-HANDLERS
  3602. QUEUE-EVENT
  3603.                        ;Image
  3604. COPY-IMAGE
  3605. CREATE-IMAGE
  3606. GET-IMAGE
  3607. IMAGE-BLUE-MASK
  3608. IMAGE-DEPTH
  3609. IMAGE-GREEN-MASK
  3610. IMAGE-HEIGHT
  3611. IMAGE-NAME
  3612. IMAGE-PIXMAP
  3613. IMAGE-PLIST
  3614. IMAGE-RED-MASK
  3615. IMAGE-WIDTH
  3616. IMAGE-X-HOT
  3617. IMAGE-Y-HOT
  3618. PUT-IMAGE
  3619. READ-BITMAP-FILE
  3620. WRITE-BITMAP-FILE
  3621.                        ;Keysyms
  3622. CHARACTER->KEYSYMS
  3623. CHARACTER-IN-MAP-P
  3624. DEFAULT-KEYSYM-INDEX
  3625. DEFAULT-KEYSYM-TRANSLATE
  3626. DEFINE-KEYSYM
  3627. DEFINE-KEYSYM-SET
  3628. KEYCODE->CHARACTER
  3629. KEYCODE->KEYSYM
  3630. KEYSYM
  3631. KEYSYM->CHARACTER
  3632. KEYSYM-IN-MAP-P
  3633. KEYSYM-SET
  3634. UNDEFINE-KEYSYM
  3635.                        ;Properties
  3636. CUT-BUFFER
  3637. GET-STANDARD-COLORMAP
  3638. GET-WM-CLASS
  3639. ICON-SIZES
  3640. MAKE-WM-HINTS
  3641. MAKE-WM-SIZE-HINTS
  3642. ROTATE-CUT-BUFFERS
  3643. SET-STANDARD-COLORMAP
  3644. SET-WM-CLASS
  3645. TRANSIENT-FOR
  3646. WM-CLIENT-MACHINE
  3647. WM-COMMAND
  3648. WM-HINTS
  3649. WM-HINTS-FLAGS
  3650. WM-HINTS-ICON-MASK
  3651. WM-HINTS-ICON-PIXMAP
  3652. WM-HINTS-ICON-WINDOW
  3653. WM-HINTS-ICON-X
  3654. WM-HINTS-ICON-Y
  3655. WM-HINTS-INITIAL-STATE
  3656. WM-HINTS-INPUT
  3657. WM-HINTS-P
  3658. WM-HINTS-WINDOW-GROUP
  3659. WM-ICON-NAME
  3660. WM-NAME
  3661. WM-NORMAL-HINTS
  3662. WM-SIZE-HINTS-HEIGHT
  3663. WM-SIZE-HINTS-HEIGHT-INC
  3664. WM-SIZE-HINTS-MAX-ASPECT
  3665. WM-SIZE-HINTS-MAX-HEIGHT
  3666. WM-SIZE-HINTS-MAX-WIDTH
  3667. WM-SIZE-HINTS-MIN-ASPECT
  3668. WM-SIZE-HINTS-MIN-HEIGHT
  3669. WM-SIZE-HINTS-MIN-WIDTH
  3670. WM-SIZE-HINTS-P
  3671. WM-SIZE-HINTS-USER-SPECIFIED-POSITION-P
  3672. WM-SIZE-HINTS-USER-SPECIFIED-SIZE-P
  3673. WM-SIZE-HINTS-WIDTH
  3674. WM-SIZE-HINTS-WIDTH-INC
  3675. WM-SIZE-HINTS-X
  3676. WM-SIZE-HINTS-Y
  3677. WM-ZOOM-HINTS
  3678.                        ;Misc.
  3679. MAKE-COLOR
  3680. MAKE-EVENT-KEYS
  3681. MAKE-EVENT-MASK
  3682. MAKE-RESOURCE-DATABASE
  3683. MAKE-STATE-KEYS
  3684. MAKE-STATE-MASK
  3685. DISCARD-FONT-INFO
  3686. TRANSLATE-DEFAULT
  3687.                        ;Structures
  3688. BITMAP-FORMAT-LSB-FIRST-P
  3689. BITMAP-FORMAT-P
  3690. BITMAP-FORMAT-PAD
  3691. BITMAP-FORMAT-UNIT
  3692. BITMAP-IMAGE
  3693.  
  3694. COLOR-BLUE
  3695. COLOR-GREEN
  3696. COLOR-P
  3697. COLOR-RED
  3698. COLOR-RGB
  3699. COLORMAP-DISPLAY
  3700. COLORMAP-EQUAL
  3701. COLORMAP-ID
  3702. COLORMAP-P
  3703. COLORMAP-VISUAL-INFO
  3704.  
  3705. CURSOR-DISPLAY
  3706. CURSOR-EQUAL
  3707. CURSOR-ID
  3708. CURSOR-P
  3709.  
  3710. DRAWABLE-DISPLAY
  3711. DRAWABLE-EQUAL
  3712. DRAWABLE-ID
  3713. DRAWABLE-P
  3714.  
  3715. FONT-DISPLAY
  3716. FONT-EQUAL
  3717. FONT-ID
  3718. FONT-MAX-BOUNDS
  3719. FONT-MIN-BOUNDS
  3720. FONT-P
  3721. FONT-PLIST
  3722.  
  3723. GCONTEXT-DISPLAY
  3724. GCONTEXT-EQUAL
  3725. GCONTEXT-ID
  3726. GCONTEXT-P
  3727. GCONTEXT-PLIST
  3728.  
  3729. DISPLAY-AUTHORIZATION-DATA
  3730. DISPLAY-AUTHORIZATION-NAME
  3731. DISPLAY-BITMAP-FORMAT
  3732. DISPLAY-BYTE-ORDER
  3733. DISPLAY-DEFAULT-SCREEN
  3734. DISPLAY-DISPLAY
  3735. DISPLAY-ERROR-HANDLER
  3736. DISPLAY-IMAGE-LSB-FIRST-P
  3737. DISPLAY-KEYCODE-RANGE
  3738. DISPLAY-MAX-KEYCODE
  3739. DISPLAY-MAX-REQUEST-LENGTH
  3740. DISPLAY-MIN-KEYCODE
  3741. DISPLAY-MOTION-BUFFER-SIZE
  3742. DISPLAY-NSCREENS
  3743. DISPLAY-P
  3744. DISPLAY-PIXMAP-FORMATS
  3745. DISPLAY-PLIST
  3746. DISPLAY-PROTOCOL-MAJOR-VERSION
  3747. DISPLAY-PROTOCOL-MINOR-VERSION
  3748. DISPLAY-PROTOCOL-VERSION
  3749. DISPLAY-RELEASE-NUMBER
  3750. DISPLAY-RESOURCE-ID-BASE
  3751. DISPLAY-RESOURCE-ID-MASK
  3752. DISPLAY-ROOTS
  3753. DISPLAY-SQUISH
  3754. DISPLAY-VENDOR
  3755. DISPLAY-VENDOR-NAME
  3756. DISPLAY-VERSION-NUMBER
  3757. DISPLAY-XDEFAULTS
  3758. DISPLAY-XID
  3759.  
  3760. PIXMAP-DISPLAY
  3761. PIXMAP-EQUAL
  3762. PIXMAP-FORMAT-BITS-PER-PIXEL
  3763. PIXMAP-FORMAT-DEPTH
  3764. PIXMAP-FORMAT-P
  3765. PIXMAP-FORMAT-SCANLINE-PAD
  3766. PIXMAP-ID
  3767. PIXMAP-P
  3768. PIXMAP-PLIST
  3769.  
  3770. SCREEN-BACKING-STORES
  3771. SCREEN-BLACK-PIXEL
  3772. SCREEN-DEFAULT-COLORMAP
  3773. SCREEN-DEPTHS
  3774. SCREEN-EVENT-MASK-AT-OPEN
  3775. SCREEN-HEIGHT
  3776. SCREEN-HEIGHT-IN-MILLIMETERS
  3777. SCREEN-MAX-INSTALLED-MAPS
  3778. SCREEN-MIN-INSTALLED-MAPS
  3779. SCREEN-P
  3780. SCREEN-PLIST
  3781. SCREEN-ROOT
  3782. SCREEN-ROOT-DEPTH
  3783. SCREEN-ROOT-VISUAL-INFO
  3784. SCREEN-SAVE-UNDERS-P
  3785. SCREEN-WHITE-PIXEL
  3786. SCREEN-WIDTH
  3787. SCREEN-WIDTH-IN-MILLIMETERS
  3788.  
  3789. VISUAL-INFO
  3790. VISUAL-INFO-BITS-PER-RGB
  3791. VISUAL-INFO-BLUE-MASK
  3792. VISUAL-INFO-CLASS
  3793. VISUAL-INFO-COLORMAP-ENTRIES
  3794. VISUAL-INFO-GREEN-MASK
  3795. VISUAL-INFO-ID
  3796. VISUAL-INFO-P
  3797. VISUAL-INFO-PLIST
  3798. VISUAL-INFO-RED-MASK
  3799.  
  3800. WINDOW-DISPLAY
  3801. WINDOW-EQUAL
  3802. WINDOW-ID
  3803. WINDOW-P
  3804. WINDOW-PLIST
  3805.